1. 14 Apr, 2022 2 commits
    • Expand dtype accessors (#3868) · ba7a0fac
      * Added constructor based on typenum, based on PyArray_DescrFromType
      
      Added accessors for typenum, alignment, byteorder and flags fields of
      PyArray_Descr struct.
      
      * Added tests for new py::dtype constructor, and for accessors
      
      * [pre-commit.ci] auto fixes from pre-commit.com hooks
      
      for more information, see https://pre-commit.ci
      
      * Fixed the comment for alignment method
      
      * Update include/pybind11/numpy.h
      
      Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
      
      * [pre-commit.ci] auto fixes from pre-commit.com hooks
      
      for more information, see https://pre-commit.ci
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
      Oleksandr Pavlyk committed
    • Adds set_name method of pybind11::capsule class (#3866) · fa98804a
      * Adds set_name method of pybind11::capsule class
      
      This calls PyCapsule_SetName on the underlying capsule object.
      
      modified destructors to query capsules's Name
      
      [pre-commit.ci] auto fixes from pre-commit.com hooks
      
      for more information, see https://pre-commit.ci
      
      Handle possible exception thrown by PyCapsule_GetName
      
      Also removed accidentally reintroduced use of `const char *&`.
      
      [pre-commit.ci] auto fixes from pre-commit.com hooks
      
      for more information, see https://pre-commit.ci
      
      Fixed function name
      
      * Introduced private static function to reuse get_name_or_throw
      
      * added tests for capsule renaming
      
      * [pre-commit.ci] auto fixes from pre-commit.com hooks
      
      for more information, see https://pre-commit.ci
      
      * handle python error in flight
      
      * [pre-commit.ci] auto fixes from pre-commit.com hooks
      
      for more information, see https://pre-commit.ci
      
      * Initialized PyObject * variables to nullptr
      
      * use write-unraisable if PyCapsule_GetName raises
      
      * [pre-commit.ci] auto fixes from pre-commit.com hooks
      
      for more information, see https://pre-commit.ci
      
      * get_name_or_throw->get_name_no_throw
      
      If PyCapsule_GetName raises an error we should write as unraisable
      to consume it and notify user, and then restore the error in flight if any.
      This way this method called from destructor would not modify interpreter
      error state.
      
      * used error_scope struct
      
      * Renamed get_name_no_throw->get_name_in_error_scope
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      Oleksandr Pavlyk committed
  2. 11 Apr, 2022 6 commits
  3. 05 Apr, 2022 1 commit
    • perf: Add more moves and optimize (#3845) · c4e29528
      * Make slice constructor consistent
      
      * Add more missing std::move for ref steals
      
      * Add missing perfect forwarding for arg_v ctor
      
      * Add missing move in arg_v constructor
      
      * Revert "Add missing move in arg_v constructor"
      
      This reverts commit 126fc7c524ea7a51b54720defd75de3470d69557.
      
      * Add another missing move in cast.h
      
      * Optimize object move ctor
      
      * Don't do useless move
      
      * Make move ctor same as nb
      
      * Make obj move ctor same as nb
      
      * Revert changes which break MSVC
      Aaron Gokaslan committed
  4. 04 Apr, 2022 1 commit
  5. 01 Apr, 2022 1 commit
  6. 31 Mar, 2022 1 commit
  7. 28 Mar, 2022 1 commit
  8. 25 Mar, 2022 4 commits
  9. 24 Mar, 2022 1 commit
  10. 22 Mar, 2022 2 commits
  11. 18 Mar, 2022 1 commit
  12. 17 Mar, 2022 2 commits
  13. 15 Mar, 2022 1 commit
  14. 11 Mar, 2022 1 commit
    • PYBIND11_OBJECT_CVT should use namespace for error_already_set() (#3797) · 91a6e129
      * PYBIND11_OBJECT_CVT should use namespace for error_already_set()
      
      This change makes the macro usable outside of pybind11 namespace.
      
      * added test for use of PYBIND11_OBJECT_CVT for classes in external to pybind11 namespaces
      
      * Extended test_pytypes.cpp and test_pytest.py
      
      The added test defines a dummy function that takes a custom-defined class external::float_
      that uses PYBIND11_OBJECT_CVT
      
      * [pre-commit.ci] auto fixes from pre-commit.com hooks
      
      for more information, see https://pre-commit.ci
      
      * fixed issues pointed out by CI
      
      * [pre-commit.ci] auto fixes from pre-commit.com hooks
      
      for more information, see https://pre-commit.ci
      
      * fixed memory leak in default constructor
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      Oleksandr Pavlyk committed
  15. 10 Mar, 2022 1 commit
  16. 02 Mar, 2022 3 commits
  17. 01 Mar, 2022 3 commits
  18. 25 Feb, 2022 1 commit
  19. 23 Feb, 2022 2 commits
  20. 20 Feb, 2022 1 commit
  21. 18 Feb, 2022 1 commit
    • Fix exception handling when pybind11::weakref() fails. (#3739) · 44596bc4
      * Clear Python error state if pybind11::weakref() fails.
      
      The weakref() constructor calls pybind11_fail() without clearing any
      Python interpreter error state. If a client catches the C++ exception
      thrown by pybind11_fail(), the Python interpreter will be left in an
      error state.
      
      * Add test case for failing to create weakref
      
      * Add Debug asserts for pybind11 fail
      
      * Make error handling more pythonic
      
      * Does this fix PyPy?
      
      * Adapt test to PyPy differences
      
      * Simplify test to remove redundancy
      
      Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
      Peter Hawkins committed
  22. 16 Feb, 2022 1 commit
    • MSVC C++20 test_eigen (#3741) · 009ffc33
      * Removing C++20 condition for MSVC is_template_base_of decltype workaround.
      
      * `-DDOWNLOAD_EIGEN=ON` for MSVC 2022 C++20
      
      * `-DDOWNLOAD_EIGEN=ON` for MSVC 2019 C++20
      
      * `-DPYBIND11_WERROR=OFF` for MSVC C++20 (2019, 2020)
      
      * Restoring `defined(PYBIND11_CPP20)` in common.h
      
      * pragma warning(disable : 5054) in eigen.h
      
      * Reverting `-DPYBIND11_WERROR=OFF` changes.
      Ralf W. Grosse-Kunstleve committed
  23. 15 Feb, 2022 2 commits