* Transfer diff from pybind11k fork as-is. New tests are still missing.
* Add `PYBIND11_WARNING_DISABLE_MSVC(4127)` into `PYBIND11_OVERRIDE_IMPL` macro.
* Add test_trampoline_with_pyobject_ptr_return()
* Resolve clang-tidy error: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto,-warnings-as-errors]
* Disabled checking refcount when building with PyPy.
* Clang 3.6, 3.7, 3.9 compatibility.
```
/__w/pybind11/pybind11/tests/test_type_caster_pyobject_ptr.cpp:23:13: error: definition of implicit copy constructor for 'WithPyObjectPtrReturn' is deprecated because it has a user-declared destructor [-Werror,-Wdeprecated]
virtual ~WithPyObjectPtrReturn() = default;
^
```
* Minor clean-up of production code changes.
* Add missing `override` (to resolve clang-tidy error).
* Move PYBIND11_WARNING_POP for a better clang-format outcome.
* Add a pybing function to clear a list.
* Add required error handling.
* Add `/* py-non-const */` as suggested by @Skylion007
---------
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
* fix(cmake): do not use Python::Interpreter when cross-compiling
* chore: apply cmake-format to pybind11NewTools.cmake
* fix(cmake): do not look for Python Interpreter component when cross-compiling
* feat(cmake): guess Python extension suffix
* fix: add pybind11GuessPythonExtSuffix.cmake to packaging test
* Use PYBIND11_CROSSCOMPILING instead of CMAKE_CROSSCOMPILING
* refactor: require PYBIND11_USE_CROSSCOMPILING
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
* ci: try Python 3.13t
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* fix: support Python 3.13t
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* fix: patch PyPy
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* tests: one more int cast
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* tests: cleanup
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* refactor: use named constant in tests for immortal refcounts
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* docs: move comment about free threaded Python
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* ci: add Python 3.13
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* tests: run the gc for 3.13+
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* Revert "tests: run the gc for 3.13+"
This reverts commit fe8a3ce3d1.
* ci: drop macos ARM for now, need pin updates
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* fix: use Python 3.13 API if on 3.13
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* Call concat with proper namespace in cast.h
* Apply suggestions from code review
* tests: add test for ADL on concat
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* fix: fully qualify all usages of concat
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
* Transfer bug fixes from #4888 wholesale. Full test coverage for all fixes is still missing.
* Add cmake option(PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION) and use in some tests.
* API: Make `numpy.h` compatible with both NumPy 1.x and 2.x
* TST: Update numpy dtype flags test to not covert flags to char
* API: Add `numpy2.h` instead and make `numpy.h` safe
This means that users of `numpy.h` cannot be broken, but need to
update to `numpy2.h` if they want to compile for NumPy 2.
Using Macros simply and didn't bother to try to remove unnecessary
code paths.
* API: Rather than `numpy2.h` use a define for the user.
* Thread `PYBIND11_NUMPY2_SUPPORT` through things and try to adept test matrix
* Small fixups (shouldn't matter)?
* Fixup. Does upgrading scipy help? (it shouldn't?)
(Some other small fixup)
* Use NumPy 2 nightlies for ubuntu-latest job also
* BUG: Fix numpy.bool check
* TST: Fix complexwarning
* BUG: Fix the fact that only the 50 slot is filled with the copy alias
(There were 3 functions all doing the same, only this slot survived 2.x)
* TST: One more test tweak
* TST: Use "long" name for long, since it changed on windows
* TST: Apparently we didn't always have ulong, so just use `L`
* TST: Enforce dtype='l' for test as default isn't long anymore on windows
* Rename macro and invert logic to PYBIND11_NUMPY_1_ONLY
* PYBIND11_INTERNAL_NUMPY_1_ONLY_DETECTED
* Test and code comment expansion
* CI: Use pre-releases of numpy/scipy from pip via explicit version
* CI: NumPy 2 only available on almalinux (as it is Python >=3.9)
* MAINT: Match name more exactly and adopt error phrasing
* MAINT: Pushed early, move helper to be private member
* fix error message compilation when using NumPy 1.x-only backcompat
* silence name shadowing warning
* chore: minor optimization
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
* ci: trying things for Windows Clang failure
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* WIP: try using older clang
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* tests: skip broken test
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* tests: try to skip test in tests
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* fix(tests): Prefer __version__ over MSVC
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* chore: avoid warning on Clang
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* Update tests/test_exceptions.py
* Update tests/test_exceptions.py
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* doc: add litgen to the automatic generators list (compiling.rst)
Added this:
[litgen]_ is an automatic python bindings generator with a focus on generating
documented and discoverable bindings: bindings will nicely reproduce the documentation
found in headers. It is is based on srcML (srcml.org), a highly scalable, multi-language
parsing tool with a developer centric approach. The API that you want to expose to python
must be C++14 compatible (but your implementation can use more modern constructs).
.. [litgen] https://pthom.github.io/litgen
* style: pre-commit fixes
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* stl.h: Use C++11 range-loops with const reference
This saves copy-ctor and dtor for non-trivial types by value
Found by clazy (range-loop-reference)
* test_smart_ptr.cpp cleanup
Introduce `pointer_set<T>`
https://github.com/boostorg/unordered/issues/139
> Based on the standard, the first move should leave a in a "valid but unspecified state";
---------
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
* fix: Use PyObject_VisitManagedDict() of Python 3.13
Use PyObject_VisitManagedDict() and PyObject_ClearManagedDict() in
pybind11_traverse() and pybind11_clear() on Python 3.13 and newer.
* Add Python 3.13 CI
* tests: don't get numpy/scipy on 3.13 yet
* ci: move 3.13 to upstream
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
* Upgrade maximum supported CMake version to 3.27 to fix warning with CMP0148 policy (#4785)
* Update `macos_brew_install_llvm` pipeline to use expected Python installation
* Fix `Python_EXECUTABLE` Cmake variable typo
* Apply suggestions from code review
* fix: use FindPython for CMake 3.18+ by default for pybind11's tests
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* tests: fix issues with finding Python
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* tests: also set executable on subdir tests
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* fix(cmake): correct logic for FindPython
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* Update ci.yml
* Revert "Update ci.yml"
This reverts commit 33798adf3f.
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>