Skip to content

Commit 66ac72c

Browse files
committed
Squashed 'pybind11/' changes from a2e59f0e..f5fbe867
f5fbe867 chore: bump to 3.0.1 (#5810) cddec2bb fix: limit warning issue (#5807) e71489c3 tests: avoid false DOWNLOAD_CATCH manually-specified variables warning (#5803) 8bbc3091 Improve buffer_info type checking in numpy docs (#5805) 03607757 correct homebrew package URL in installing.rst (#5808) adb5603f chore: rename generic slots variable (#5793) 7aa3780d Replace robotpy-build with semiwrap (#5804) ce712285 ci: avoid macOS 15 image change for iOS (#5798) c1bf55a2 Fix subinterpreter exception handling SEGFAULT (#5795) 90bc05c7 chore(deps): bump actions/download-artifact (#5792) 580494c7 fix: LTO warning of gcc >= 11.4 (#5791) 6292b704 Explain linting suppressions (#5790) 94c82508 inline get_interpreter_state_uncheccked inline function (#5789) 23c59b6e ci: add android test (#5714) a5665e3a fix: type_caster_enum_type for pointer types (#5694) (#5776) 9360553f chore(deps): update pre-commit hooks (#5785) c5e8fec9 Make function record subinterpreter safe (#5771) 0db3d59f Allow multiphase modules to be re-imported (#5782) 780ec113 Make implicitly_convertable sub-interpreter and free-threading safe (#5777) 9af8adb7 Subinterpreter creation concurrency issues in 3.12 (#5779) 6972597c docs: show nogil in most examples (#5770) 33533ff3 Fix IsolatedConfig test (#5768) 7f5eea43 Check for __cpp_lib_remove_cvref as well (#5761) 49d19fef Implement binary version of make_index_sequence (#5751) 6aeae9c3 Fix py::trampoline_self_life_support visibility in docs (#5766) 316273ef fix: don't force -fvisibility=hidden on Windows (#5757) c4ee83c4 fix:: initialize_generic compiler warning about nullptr dereference (#5756) cc69a378 chore(deps): update pre-commit hooks (#5745) 66d394f2 docs: standardize header a bit (#5749) fa72aff5 [skip ci] Small `docs/release.rst` update, mainly to remove `git push --tags`. (#5748) 422990f8 chore: get back to work (after v3.0.0 release) (#5747) ed5057de chore: prepare for 3.0.0 (final) (#5746) 4dc4aca2 [skip ci] Explain: conduit feature only covers from-Python-to-C++ conversions (#5740) 03d8f487 docs: fix typo in multiple_interpreters (#5738) ea3e33e4 chore: prepare for 3.0.0rc4 (#5736) bdc56d9e chore(deps): bump urllib3 from 2.2.2 to 2.5.0 in /docs (#5735) cf3d1a75 feat: numpy scalars (#5726) c60c1499 tests: handle 3.12 and 3.13 implementations and 3.14.0b3+ (#5732) be507b72 ci: check latest on 3.13 (#5734) f2c0ab83 Fix TSan warning in sub-interpreter test (#5729) ad9180c1 fix: android CMake support (#5733) 86e82ddb Add support for `shared_ptr<const T>` in `py::init()` with `smart_holder` (#5731) 365d41a4 Eliminate cross-DSO RTTI reliance in `smart_holder` functionality (for platforms like macOS). (#5728) e2f86af2 docs: add documentation entry for warnings (#5356) f3bb0073 better test for const only smart ptr (#5727) d218b160 ci: avoid 3.13.4 on Windows (#5725) f8640da4 chore(deps): bump pypa/cibuildwheel from 3.0.0rc2 to 3.0 in the actions group (#5721) 7ed76e2d fix: add support for const-only smart pointers (#5718) 513d1f96 ci: check iOS update (#5717) ff0e381d chore(deps): bump requests from 2.32.3 to 2.32.4 in /docs (#5720) 6c5d25aa test: run pytest under Python devmode (#5715) 5d32ed76 docs: prepare for RC 3 (#5713) c786d34f fix: handle null `py::handle` and add tests for `py::scoped_critical_section` (#5706) c7026d0d fix!: modify the internals pointer-to-pointer implementation to not use `thread_local` (#5709) b1948914 fix: expose required symbol using clang (#5700) d4d2ec1a ci: avoid brownout (and removal) of windows-2019 (#5712) 0985052a chore(deps): update pre-commit hooks (#5711) 9295c4a5 fix: follow rest of pybind11 closer with PYBIND11_HAS_SUBINTERPRETER_SUPPORT (#5710) 7da1d53d ci: test on iOS (#5705) c2b32b1e fix(types): type hints from future python versions (#5693) 21c9dd11 ci: drop main tests on main e4873e8f fix: allow subinterp support to be disabled 33fb5333 fix: C++20 in Windows bc557a9b tests: add PYBIND11_TEST_SMART_HOLDER to tests 29979761 ci: rename cibw workflow file 7e672ca1 tests: support C++23 in tests ef2ad42d ci: list all jobs explicitly 5dff3354 ci: reduce runs on draft PRs df595b16 docs: changelog update for 3.0.0rc2 a1b19722 chore: prepare for 3.0.0rc2 (#5698) a18b1bc4 tests: always disable on the nogil build (#5701) 57e27c1f tests: skip some flaky gil tests on nogil (#5699) 1c10d5e9 fix: prepare for 3.14 beta 2 (#5697) 6e3e8515 fix(cmake): regression in include gaurd (#5691) 03b4a9e5 fix: don't destruct module objects in atexit (#5688) 1dd85ef4 chore: bump maximum clang tested to 20 (#5692) 9d066265 docs: more warnings about locking and the GIL (#5689) d7769de5 feat: scoped_critical_section (#5684) e3883dd5 refactor: use CPython macros to construct `PYBIND11_VERSION_HEX` (#5683) e4622cbd chore(cmake): add compile commands to preset (#5685) 98bd78f0 chore: rename macro `PYBIND11_SUBINTERPRETER_SUPPORT` -> `PYBIND11_HAS_SUBINTERPRETER_SUPPORT` to meet naming convention (#5682) 8d503e30 docs: update contributing/release guide a little (#5681) 2624d4a3 tests: expect free-threaded import warnings (#5680) fc888f75 docs: prepare for 3.0.0rc1 (#5679) e8f16e2f docs: remove setup.py mentions, mention presets (#5677) 07d028f2 feat: Embeded sub-interpreters (#5666) ec8b0508 chore: convert changelog to markdown (#5672) e6256684 fix(cmake): error wasn't triggering (#5676) 7319402a chore: show preview on docs changes (#5673) 3867c5f5 ci: add nightlies for scientific-python (#5675) 9e6fe464 chore: consolidate common code in PYBIND11_MODULE and PYBIND11_EMBEDDED_MODULE (#5670) 67424358 fix(types): add typing and collections.abc module prefix (#5663) 4587d33c docs: prepare for v3.0.0rc1 (#5589) cc86e8b2 fix(cmake): better --fresh support (#5668) 6bf25d1e feat: add semi-public API: `pybind11::detail::is_holder_constructed` (#5669) 9afc9c4f feat: change PYBIND11_EMBEDDED_MODULE to multiphase init (#5665) 094343c7 fix: support Python 3.14 (#5646) 1107c093 docs: Add documentation for mod_gil_not_used and multiple_interpreters (#5659) af231a60 chore: use scikit-build-core for the build (#5598) 6aa3b335 fix(types): Buffer type hint (#5662) 95e8f89b Support for sub-interpreters (#5564) 05a6a03e chore(cmake): add CMake presets (#5655) 853bafa0 fix: use original dict (#5658) c5dc6f9f ci: bump default versions (#5657) 74b52427 feat: add `py::potentially_slicing_weak_ptr(handle)` function (#5624) ce42c4df fix(cmake): avoid message if FINDPYTHON NEW (#5656) d7d782c5 fix(regression): support embedded submodule (#5650) 9a191c24 Fix typos for FindPython compact mode: `Python_LIRAR{Y,IES}` -> `Python_LIBRAR{Y,IES}` (#5653) c125cc78 Collect all `#define PYBIND11_HAS_...` in pybind11/detail/common.h (#5647) 002c05b1 fix: handle MSVC warning C4866: compiler may not enforce left-to-right evaluation order (#5641) a265a4cf fix: define _DEBUG macro to 1 on redefinition (#5639) 099583c5 chore(deps): update pre-commit hooks (#5642) c630e22c Add `static_assert`s to enforce that `py::smart_holder` is combined with `py::trampoline_self_life_support` (#5633) c7f3460f Fix gcc compiler warnings (#5523) d3fee429 chore(deps): bump astral-sh/setup-uv from 5 to 6 in the actions group (#5632) bc4a66df fix: provide useful behavior of default `py::slice` (#5620) 5c498583 fix: upgrade 20.04 runners to 22.04 (fix for ICC, NVHPC) (#5621) 223e2e9d Fix missing pythonic type hints for native_enum (#5619) 3c586340 Add class doc string to native_enum (#5617) b3bb31ca ci: work on speeding up further (#5613) cbcc2385 Factor out pybind11/gil_simple.h (#5614) ee04df0d Updated STL casters and py::buffer to use collections.abc (#5566) f3c19138 Remove obsolete `"E501"` line in pyproject.toml (#5539) 662a88cb ci: speed up ci a bit by thinning out matrix (#5602) a2951abb chore(deps): update pre-commit hooks (#5605) d25e91fb fix(cmake): warning about missing file (#5612) 31e52b2c Add holder caster traits tests in test_smart_ptr.cpp,py (#5603) e38beb96 [skip ci] Move "Pitfalls with raw pointers and shared ownership" section to a more prominent location. (#5611) 1bd1d1ce Change `PyCFunction` cast in function_record_pyobject.h to sidestep unhelpful compiler warnings. (#5608) 708ce4d9 Fix GraalPy version parsing on dev builds (#5609) a28ea8cc Eliminate `pybindit` namespace (#5607) 6d1f28fe feat: remove make_simple_namespace (#5597) 73ad3099 fix: fully deprecate get_type_of (deprecated in 2.6 but no warning (#5596) b70b8eb3 chore: require pytest 6 consistently (#5599) fdab860a feat: drop PYBIND11_NUMPY_1_ONLY (#5595) 55b1357d chore: update nox and test deps (#5594) 8ef10a0e ci: update to GraalPy 24.2 and mention in README (#5586) d27fdaa2 chore: update for CMake 4.0 (#5593) e03ec306 Squashed function_record_std_launder/manuscript — 57b9a0af815d19b236b74be06a172bc5c9956618 — 2025-03-30 20:14:21 -0700 (#5592) a34fcdc4 [ci skip] Response to question by gh-henryiii (pybind/pybind11#5580 (comment)) (#5591) 8726ed22 Fix build failure when `shared_ptr<T>` points to `private` `std::enable_shared_from_this` base (#5590) e7e5d6e5 Make wrapped C++ functions pickleable (#5580) 8f00d1ee fix: set __file__ on submodules (#5584) c1cd022f tests: Add test for `boost::histogram::func_transform` situation. (#5582) f365314e Enable Conversions Between Native Python Enum Types and C++ Enums (#5555) 48eb5ad9 Remove PyPy 3.8 and 3.9 testing. Make a pass through the entire repo to remove obviously obsolete workarounds for PyPy < 3.10. (#5578) 566894d5 Fix null pointer dereference in `attr_with_type_hint` (#5576) 974eba77 Change PYBIND11_MODULE to use multi-phase init (PEP 489) (#5574) 97022f83 TEST: test passes on PyPy macOS (#5569) 6412615e Update NDArray[object] to be NDArray[numpy.object_] (#5571) bb504dd8 fix: FindPython by default logic error (#5561) 655c60d8 docs: fix incorrect name (PYBIND11_NEWPYTHON) (#5570) 9f08625d Updated py::capsule type hint to use new types.CapsuleType (#5567) dfe7e65b feat(types): Use `typing.SupportsInt` and `typing.SupportsFloat` and fix other typing based bugs. (#5540) 16b5abd4 chore: bump catch download to 2.13.10 (#5568) d28904f1 feat: FindPython by default (#5553) 06e8ee2e chore(deps): bump actions/attest-build-provenance in the actions group (#5556) d422fda1 chore(deps): bump jinja2 from 3.1.5 to 3.1.6 in /docs (#5554) e24e300c chore(deps): update pre-commit hooks (#5547) a822be20 chore(deps): bump the actions group with 2 updates (#5546) ded70fe6 Add pkgconf-pypi entrypoint (#5552) 79be5c83 test: Explicitly mark char as signed in dtype tests (#5545) 2943a27a squash-merge smart_holder branch into master (#5542) d8565ac7 Sync `Py_TPFLAGS_MANAGED_DICT` for PyPy3.11 across the codebase (#5537) 09b9f44a add recently released pypy3.11 (#5534) 73825f35 Improved reference_internal documentation (#5528) b7c33009 Start pybind11v3: Remove all code for `PYBIND11_INTERNALS_VERSION`s `4` and `5` (#5530) 24152422 feat(types) Numpy.typing.NDArray (#5212) 34a118fd Add `release_gil_before_calling_cpp_dtor` annotation for `class_` (#5522) c316cf36 Make PYBIND11_INTERNALS_VERSION 6 the default on all platforms. (#5512) 31d7c870 Remove some maybe-uninitialized warnings (#5516) d2e7e8c6 chore(deps): update pre-commit hooks (#5513) ab44b307 Skip transient crash on GraalPy on OS X (#5514) 8862cd4e chore(deps): bump seanmiddleditch/gha-setup-ninja in the actions group (#5509) fe87568f PyPy 3.11 does not implement Py_TPFLAGS_MANAGED_DICT (#5508) 82845c3b chore(deps): bump actions/attest-build-provenance in the actions group (#5503) 924261e8 chore(cmake): Add an author warning that auto-calculated `PYTHON_MODULE_EXTENSION` may not respect `SETUPTOOLS_EXT_SUFFIX` during cross-compilation (#5495) c19c291b feat: --extension-suffix for pybind11 command (#5360) 167bb5f2 fix(cmake): don't strip with BUILD_TYPE None (#5392) 1b7aa0bb feat: rework of arg/return type hints to support .noconvert() (#5486) 15d9dae1 Fix data race when using shared variables (free threading) (#5494) 945e251a chore(deps): bump jinja2 from 3.1.4 to 3.1.5 in /docs (#5490) a09cf618 chore(deps): update pre-commit hooks (#5488) c5ed9d4b Fix module type hint (#5469) cf020a1d feat(types) Allow setting types for attributes (#5460) 5b503f7e chore(deps): bump actions/attest-build-provenance in the actions group (#5468) 3e419485 `PYBIND11_PLATFORM_ABI_ID` Modernization Continued (platforms other than MSVC) (#5439) 741d86f2 Drop Clang dev CI job (#5464) 3ebdc503 chore(deps): bump actions/attest-build-provenance in the actions group (#5461) b17555f3 chore(deps): update pre-commit hooks (#5459) 1d09fc83 Option for arg/return type hints and correct typing for std::filesystem::path (#5450) a6d1ff24 fix: make PYBIND11_WARNING_POP actually pop clang diagnostics (#5448) e7c9b907 chore(deps): bump pypa/cibuildwheel in the actions group (#5451) 83b92ceb Try to fix reentrant write transient failures in tests (#5447) 330aae51 Remove mingw-w64-i686-python-numpy from mingw32 build (it does not seem to exist anymore). (#5445) f41dae31 Add dtype::normalized_num and dtype::num_of (#5429) b9fb3168 Add support for array_t<handle> and array_t<object> (#5427) 08095d9c Run pytest in verbose mode (#5443) 0ed20f26 chore(deps): bump actions/attest-build-provenance in the actions group (#5440) 7f94f24d feat(typing): allow annotate methods with `pos_only` when only have the `self` argument (#5403) 6d98d4d8 Add type hints for args and kwargs (#5357) a90e2af8 Factor out pybind11/conduit/pybind11_platform_abi_id.h (#5375) ec9c2681 Fix MSVC MT/MD incompatibility in PYBIND11_BUILD_ABI (#4953) 037310ea Use std::unique_ptr in pybind11_getbuffer (#5435) ce2f0055 Fixed data race in all_type_info in free-threading mode (#5419) f46f5be4 Fix incorrect link syntax in upgrade guide (#5434) 5c07feef chore(deps): update pre-commit hooks (#5432) bc041de0 Fix buffer protocol implementation (#5407) 75e48c5f Skip transient tests on GraalPy (#5422) f7e14e98 Address regression introduced in #5381 (#5396) 077e49fc Export libc++ exceptions (#5390) f2907651 Fix #5399: iterator increment operator does not skip first item (#5400) af67e873 docs/advanced A document about deadlock potential with C++ statics (#5394) 56e69a20 Print key in KeyError in map.__getitem__/__delitem__ (#5397) c4a05f93 Add support for GraalPy (#5380) 7e418f49 Allow subclasses of py::args and py::kwargs (#5381) 1f8b4a7f fix(cmake): `NO_EXTRAS` in `pybind11_add_module` function partially working (#5378) ad9fd39e chore(deps): bump pypa/cibuildwheel in the actions group (#5376) 1d9483ff Added exception translator specific mutex used with try_translate_exceptions (#5362) a7910be6 Add warn disable for GGC 12 bound checking error (#5355) 0cf3a0f7 ci: PyPI attestations (#5374) 5b7c0b04 docs: update changelog for 2.13.6 (#5372) ef5a9560 Enable type-safe interoperability between different independent Python/C++ bindings systems. (#5296) 5efc7439 chore(deps): bump the actions group with 2 updates (#5361) 8a801bdc chore(deps): update pre-commit hooks (#5350) aeda49ed Properly translate C++ exception to Python exception when creating Python buffer from wrapped object (#5324) 66c3774a Warnings wrappers to use from C++ (#5291) 65f4266c Add `while True` & `top` method to FAQ. (#5340) 3fb16ad1 fix: using `__cpp_nontype_template_args` instead of `__cpp_nontype_template_parameter_class` (#5330) e8f595bb chore(deps): bump actions/attest-build-provenance in the actions group (#5335) c2291e59 docs: prepare for 2.13.5 (#5327) efa2b20d docs: clarify requirements for including pybind11 (#5326) 9966ad40 fix: allow -Wpedantic in C++20 mode (#5322) 2baf9d68 fix: `<ranges>` support for `py::tuple` and `py::list` (#5314) 7d85baa6 fix: never use `..` in a header include (#5321) a1d00916 Backport of google/pybind11clif#30034 (#5305) bd5951b6 docs: prepare for 2.13.4 (#5312) 28dbce41 feat: require CMake 3.15+ (#5304) d893f972 fix: escape paths with spaces in pybind11-config (#4874) fc97cc41 Revert "fix: quote paths from pybind11-config (#5302)" (#5309) 01169061 chore: remove repetitive words (#5308) 0d44d720 Make stl.h `list|set|map_caster` more user friendly. (#4686) 4a06eca5 docs: prepare for 2.13.3 8d9f4d50 fix: quote paths from pybind11-config (#5302) 1fe92c7b fix: emscripten cmake issue (#5301) 40f2c786 docs: prepare for 2.13.2 (#5299) 8d90b83b chore(deps): bump actions/attest-build-provenance in the actions group (#5297) fc59f4e6 fix(cmake): add required emscripten flags (#5298) 89879448 Add `type_caster_std_function_specializations` feature. (#4597) 20551ab3 chore(deps): update pre-commit hooks (#5288) 84510538 chore(deps): bump the actions group with 2 updates (#5287) 916778df fix: typo in documentation (#5284) 72330728 feat: remove Python 3.7 support (#5191) 2e260b06 clang-tidy upgrade (to version 18) (#5272) 8e7307f0 docs: remove outdated known limitation. (#5263) 6d4805ce Small cleanup/refactoring in support of PR #5213 (#5251) a582ca8a tests: run on pyodide (#4745) dbf848af docs: extend `PYBIND11_MODULE` documentation, mention `mod_gil_not_used` (#5250) 43de8014 fix: make gil_safe_call_once thread-safe in free-threaded CPython (#5246) ccefee4c chore(deps): bump actions/attest-build-provenance in the actions group (#5243) 50acb81b chore(deps): bump certifi from 2024.2.2 to 2024.7.4 in /docs (#5226) bb05e081 Use PyMutex instead of std::mutex in free-threaded build. (#5219) b21b0490 chore(deps): update pre-commit hooks (#5220) d78446cc chore(deps): bump actions/attest-build-provenance in the actions group (#5216) d805e996 feat(types) Adds special Case for empty C++ tuple type annotation (#5214) 51c2aa16 Fixed a compilation error with gcc 14 (#5208) 08f946a4 fix: add guard for GCC <10.3 on C++20 (#5205) e0f9e774 fix(cmake): remove extra = in flto assignment (#5207) 57287b57 docs: prepare for 2.13.1 (#5203) 4bd538a4 feat(types): add support for Typing.Callable Special Case (#5202) 2e35470c fix: use manual padding of instance_map_shard (#5200) 895e6572 chore: back to work REVERT: a2e59f0e chore: bump to 2.13.6 REVERT: e445ca2b ci: PyPI attestations (#5374) REVERT: 7b67d8e9 docs: update changelog for 2.13.6 (#5372) REVERT: a5fcc560 Enable type-safe interoperability between different independent Python/C++ bindings systems. (#5296) REVERT: 54ab4249 chore(deps): bump the actions group with 2 updates (#5361) REVERT: 36ee4674 chore(deps): update pre-commit hooks (#5350) REVERT: 9e6a67d5 Properly translate C++ exception to Python exception when creating Python buffer from wrapped object (#5324) REVERT: 570d323b Add `while True` & `top` method to FAQ. (#5340) REVERT: b9f85757 fix: using `__cpp_nontype_template_args` instead of `__cpp_nontype_template_parameter_class` (#5330) REVERT: 0a96ff7e chore(deps): bump actions/attest-build-provenance in the actions group (#5335) REVERT: 7c33cdc2 chore: prepare for 2.13.5 REVERT: b3f5f2e7 docs: prepare for 2.13.5 (#5327) REVERT: a4f6627d docs: clarify requirements for including pybind11 (#5326) REVERT: 0d21cadc fix: allow -Wpedantic in C++20 mode (#5322) REVERT: ff3ca786 fix: `<ranges>` support for `py::tuple` and `py::list` (#5314) REVERT: b0050f30 fix: never use `..` in a header include (#5321) REVERT: c6239a8a chore: version 2.13.4 REVERT: 63b0d146 docs: prepare for 2.13.4 (#5312) REVERT: 973a16e9 fix: escape paths with spaces in pybind11-config (#4874) REVERT: 75c11769 Revert "fix: quote paths from pybind11-config (#5302)" (#5309) REVERT: 6685547e chore: remove repetitive words (#5308) REVERT: bd676436 chore: prepare for 2.13.3 REVERT: 7662af69 docs: prepare for 2.13.3 REVERT: 45eaee91 fix: quote paths from pybind11-config (#5302) REVERT: 835139f5 fix: emscripten cmake issue (#5301) REVERT: 07f30430 chore: prepare for 2.13.2 REVERT: 6d5704cd docs: prepare for 2.13.2 (#5299) REVERT: 6ee574fa chore(deps): bump actions/attest-build-provenance in the actions group (#5297) REVERT: d8fcfe34 fix(cmake): add required emscripten flags (#5298) REVERT: 78e26321 Add `type_caster_std_function_specializations` feature. (#4597) REVERT: 44d0d9a4 chore(deps): update pre-commit hooks (#5288) REVERT: fe808a01 chore(deps): bump the actions group with 2 updates (#5287) REVERT: f9ae715d fix: typo in documentation (#5284) REVERT: 042c3cfd clang-tidy upgrade (to version 18) (#5272) REVERT: 667563dd docs: remove outdated known limitation. (#5263) REVERT: 129934ad Small cleanup/refactoring in support of PR #5213 (#5251) REVERT: f50830ea tests: run on pyodide (#4745) REVERT: b4307453 docs: extend `PYBIND11_MODULE` documentation, mention `mod_gil_not_used` (#5250) REVERT: f3a6d414 fix: make gil_safe_call_once thread-safe in free-threaded CPython (#5246) REVERT: d699e99c chore(deps): bump actions/attest-build-provenance in the actions group (#5243) REVERT: 4b2f7cd6 chore(deps): bump certifi from 2024.2.2 to 2024.7.4 in /docs (#5226) REVERT: 8443d084 Use PyMutex instead of std::mutex in free-threaded build. (#5219) REVERT: 41726b64 chore(deps): update pre-commit hooks (#5220) REVERT: ea10a69d chore(deps): bump actions/attest-build-provenance in the actions group (#5216) REVERT: a4dd41a1 feat(types) Adds special Case for empty C++ tuple type annotation (#5214) REVERT: 639ca6a7 Fixed a compilation error with gcc 14 (#5208) REVERT: 65afa13e fix: add guard for GCC <10.3 on C++20 (#5205) REVERT: 3074608e fix(cmake): remove extra = in flto assignment (#5207) REVERT: 941f45bc chore: prepare for 2.13.1 REVERT: 63020d33 docs: prepare for 2.13.1 (#5203) REVERT: dd0e4a0b feat(types): add support for Typing.Callable Special Case (#5202) REVERT: 3b47b464 fix: use manual padding of instance_map_shard (#5200) git-subtree-dir: pybind11 git-subtree-split: f5fbe867d2d26e4a0a9177a51f6e568868ad3dc8
1 parent 3a91588 commit 66ac72c

File tree

257 files changed

+21328
-6844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+21328
-6844
lines changed

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Checks: |
6363
-bugprone-reserved-identifier,
6464
-bugprone-unused-raii,
6565
-performance-enum-size,
66+
-performance-inefficient-string-concatenation,
6667
6768
CheckOptions:
6869
- key: modernize-use-equals-default.IgnoreMacros

.codespell-ignore-lines

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ template <op_id id, op_type ot, typename L, typename R>
1212
template <detail::op_id id, detail::op_type ot, typename L, typename R, typename... Extra>
1313
class_ &def(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
1414
class_ &def_cast(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
15+
int valu;
16+
explicit movable_int(int v) : valu{v} {}
17+
movable_int(movable_int &&other) noexcept : valu(other.valu) { other.valu = 91; }
18+
explicit indestructible_int(int v) : valu{v} {}
19+
REQUIRE(hld.as_raw_ptr_unowned<zombie>()->valu == 19);
20+
REQUIRE(othr.valu == 19);
21+
REQUIRE(orig.valu == 91);
22+
(m.pass_valu, "Valu", "pass_valu:Valu(_MvCtor)*_CpCtor"),
23+
atyp_valu rtrn_valu() { atyp_valu obj{"Valu"}; return obj; }
24+
assert m.atyp_valu().get_mtxt() == "Valu"
25+
// valu(e), ref(erence), ptr or p (pointer), r = rvalue, m = mutable, c = const,
1526
@pytest.mark.parametrize("access", ["ro", "rw", "static_ro", "static_rw"])
1627
struct IntStruct {
1728
explicit IntStruct(int v) : value(v){};

.github/CONTRIBUTING.md

Lines changed: 55 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ the following rules to make the process as smooth as possible:
2525
* Make a new branch for every feature you're working on.
2626
* Make small and clean pull requests that are easy to review but make sure they
2727
do add value by themselves.
28-
* Add tests for any new functionality and run the test suite (`cmake --build
29-
build --target pytest`) to ensure that no existing features break.
28+
* Add tests for any new functionality and run the test suite (`cmake --workflow
29+
venv`) to ensure that no existing features break.
3030
* Please run [`pre-commit`][pre-commit] to check your code matches the
3131
project style. (Note that `gawk` is required.) Use `pre-commit run
3232
--all-files` before committing (or use installed-mode, check pre-commit docs)
@@ -81,11 +81,11 @@ nox -s build
8181
### Full setup
8282

8383
To setup an ideal development environment, run the following commands on a
84-
system with CMake 3.14+:
84+
system with CMake 3.15+:
8585

8686
```bash
87-
python3 -m venv venv
88-
source venv/bin/activate
87+
python3 -m venv .venv
88+
source .venv/bin/activate
8989
pip install -r tests/requirements.txt
9090
cmake -S . -B build -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON
9191
cmake --build build -j4
@@ -96,13 +96,44 @@ Tips:
9696
* You can use `virtualenv` (faster, from PyPI) instead of `venv`.
9797
* You can select any name for your environment folder; if it contains "env" it
9898
will be ignored by git.
99-
* If you don't have CMake 3.14+, just add "cmake" to the pip install command.
100-
* You can use `-DPYBIND11_FINDPYTHON=ON` to use FindPython on CMake 3.12+
101-
* In classic mode, you may need to set `-DPYTHON_EXECUTABLE=/path/to/python`.
102-
FindPython uses `-DPython_ROOT_DIR=/path/to` or
99+
* If you don't have CMake 3.15+, just add "cmake" to the pip install command.
100+
* You can use `-DPYBIND11_FINDPYTHON=ON` to use FindPython.
101+
* For a specific Python, you can use `-DPython_ROOT_DIR=/path/to` or
103102
`-DPython_EXECUTABLE=/path/to/python`.
104103

105-
### Configuration options
104+
## CMake presets
105+
106+
We also support CMake presets. If you have [uv](https://docs.astral.sh/uv/),
107+
you can use:
108+
109+
```bash
110+
cmake --workflow venv
111+
```
112+
113+
to setup a venv and run all tests. You can break this up into components
114+
if you want to use a specific version of Python (or any other config option) or
115+
build only one of the valid targets (listed below).
116+
117+
```bash
118+
cmake --preset venv -DPYBIND11_CREATE_WITH_UV=3.13t
119+
cmake --build --preset venv
120+
cmake --build --preset venv -t cpptest
121+
```
122+
123+
The `default` preset will use an existing venv or Python install. If you'd like
124+
to run pytest yourself, say to easily control the options:
125+
126+
```bash
127+
cd build
128+
source .venv/bin/activate
129+
cd tests
130+
python -m pytest
131+
```
132+
133+
The `.so` file is not installed into the venv, so you need to run from this
134+
directory, the local directory is included with `python -m`.
135+
136+
## Configuration options
106137

107138
In CMake, configuration options are given with "-D". Options are stored in the
108139
build directory, in the `CMakeCache.txt` file, so they are remembered for each
@@ -149,8 +180,8 @@ To run the tests, you can "build" the check target:
149180
cmake --build build --target check
150181
```
151182

152-
`--target` can be spelled `-t` in CMake 3.15+. You can also run individual
153-
tests with these targets:
183+
`--target` can be spelled `-t`. You can also run individual tests with these
184+
targets:
154185

155186
* `pytest`: Python tests only, using the
156187
[pytest](https://docs.pytest.org/en/stable/) framework
@@ -231,17 +262,17 @@ of the pybind11 repo.
231262
more complex to run, compared to `clang-format`, but support for `clang-tidy`
232263
is built into the pybind11 CMake configuration. To run `clang-tidy`, the
233264
following recipe should work. Run the `docker` command from the top-level
234-
directory inside your pybind11 git clone. Files will be modified in place,
235-
so you can use git to monitor the changes.
265+
directory inside your pybind11 git clone.
236266

237267
```bash
238-
docker run --rm -v $PWD:/mounted_pybind11 -it silkeh/clang:15-bullseye
239-
apt-get update && apt-get install -y git python3-dev python3-pytest
240-
cmake -S /mounted_pybind11/ -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--use-color" -DDOWNLOAD_EIGEN=ON -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=17
241-
cmake --build build -j 2
268+
docker run --rm -v $PWD:/pybind11 -w /pybind11 -it silkeh/clang:20
269+
apt-get update && apt-get install -y git python3-dev python3-pytest ninja-build
270+
cmake --preset tidy
271+
cmake --build --preset tidy
242272
```
243273

244-
You can add `--fix` to the options list if you want.
274+
You can add `--fix` to the options list in the preset if you want to apply fixes
275+
(remember `-j1` to run only one thread).
245276

246277
### Include what you use
247278

@@ -250,7 +281,7 @@ macOS), then run:
250281

251282
```bash
252283
cmake -S . -B build-iwyu -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE=$(which include-what-you-use)
253-
cmake --build build
284+
cmake --build build-iwyu
254285
```
255286

256287
The report is sent to stderr; you can pipe it into a file if you wish.
@@ -299,85 +330,15 @@ files inside the package, that you get access to via functions in the package,
299330
and a `pybind11-global` package that can be included via `pybind11[global]` if
300331
you want the more invasive but discoverable file locations.
301332

302-
If you want to install or package the GitHub source, it is best to have Pip 10
303-
or newer on Windows, macOS, or Linux (manylinux1 compatible, includes most
304-
distributions). You can then build the SDists, or run any procedure that makes
305-
SDists internally, like making wheels or installing.
306-
307-
308-
```bash
309-
# Editable development install example
310-
python3 -m pip install -e .
311-
```
312-
313-
Since Pip itself does not have an `sdist` command (it does have `wheel` and
314-
`install`), you may want to use the upcoming `build` package:
315-
316-
```bash
317-
python3 -m pip install build
318-
319-
# Normal package
320-
python3 -m build -s .
321-
322-
# Global extra
323-
PYBIND11_GLOBAL_SDIST=1 python3 -m build -s .
324-
```
333+
If you want to package the GitHub source for the "global" package, you need
334+
to use nox. Normal packaging will only make the normal package.
325335

326-
If you want to use the classic "direct" usage of `python setup.py`, you will
327-
need CMake 3.15+ and either `make` or `ninja` preinstalled (possibly via `pip
328-
install cmake ninja`), since directly running Python on `setup.py` cannot pick
329-
up and install `pyproject.toml` requirements. As long as you have those two
330-
things, though, everything works the way you would expect:
331336

332337
```bash
333-
# Normal package
334-
python3 setup.py sdist
335-
336-
# Global extra
337-
PYBIND11_GLOBAL_SDIST=1 python3 setup.py sdist
338+
nox -s build
339+
nox -s build_global
338340
```
339341

340-
A detailed explanation of the build procedure design for developers wanting to
341-
work on or maintain the packaging system is as follows:
342-
343-
#### 1. Building from the source directory
344-
345-
When you invoke any `setup.py` command from the source directory, including
346-
`pip wheel .` and `pip install .`, you will activate a full source build. This
347-
is made of the following steps:
348-
349-
1. If the tool is PEP 518 compliant, like Pip 10+, it will create a temporary
350-
virtual environment and install the build requirements (mostly CMake) into
351-
it. (if you are not on Windows, macOS, or a manylinux compliant system, you
352-
can disable this with `--no-build-isolation` as long as you have CMake 3.15+
353-
installed)
354-
2. The environment variable `PYBIND11_GLOBAL_SDIST` is checked - if it is set
355-
and truthy, this will be make the accessory `pybind11-global` package,
356-
instead of the normal `pybind11` package. This package is used for
357-
installing the files directly to your environment root directory, using
358-
`pybind11[global]`.
359-
2. `setup.py` reads the version from `pybind11/_version.py` and verifies it
360-
matches `includes/pybind11/detail/common.h`.
361-
3. CMake is run with `-DCMAKE_INSTALL_PREIFX=pybind11`. Since the CMake install
362-
procedure uses only relative paths and is identical on all platforms, these
363-
files are valid as long as they stay in the correct relative position to the
364-
includes. `pybind11/share/cmake/pybind11` has the CMake files, and
365-
`pybind11/include` has the includes. The build directory is discarded.
366-
4. Simpler files are placed in the SDist: `tools/setup_*.py.in`,
367-
`tools/pyproject.toml` (`main` or `global`)
368-
5. The package is created by running the setup function in the
369-
`tools/setup_*.py`. `setup_main.py` fills in Python packages, and
370-
`setup_global.py` fills in only the data/header slots.
371-
6. A context manager cleans up the temporary CMake install directory (even if
372-
an error is thrown).
373-
374-
### 2. Building from SDist
375-
376-
Since the SDist has the rendered template files in `tools` along with the
377-
includes and CMake files in the correct locations, the builds are completely
378-
trivial and simple. No extra requirements are required. You can even use Pip 9
379-
if you really want to.
380-
381342

382343
[pre-commit]: https://pre-commit.com
383344
[clang-format]: https://clang.llvm.org/docs/ClangFormat.html

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ docs:
22
all:
33
- changed-files:
44
- all-globs-to-all-files:
5-
- '!docs/changelog.rst'
5+
- '!docs/changelog.md'
66
- '!docs/upgrade.rst'
77
- base-branch: "^(?!dependabot).*"
88
- base-branch: "^(?!pre-commit-ci).*"

.github/labeler_merged.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
needs changelog:
44
- all:
55
- changed-files:
6-
- all-globs-to-all-files: "!docs/changelog.rst"
6+
- all-globs-to-all-files: "!docs/changelog.md"
77
- base-branch: "^(?!dependabot).*"
88
- base-branch: "^(?!pre-commit-ci).*"

.github/pull_request_template.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ It is recommended to use conventional commit format, see conventionalcommits.org
99

1010
## Suggested changelog entry:
1111

12-
<!-- Fill in the below block with the expected RestructuredText entry. Delete if no entry needed;
13-
but do not delete header or rst block if an entry is needed! Will be collected via a script. -->
12+
<!-- Fill in the block below with the expected entry. Delete if no entry needed;
13+
but do not delete the header if an entry is needed! Will be collected via a script. -->
1414

15-
```rst
16-
17-
```
18-
19-
<!-- If the upgrade guide needs updating, note that here too -->
15+
* Placeholder.

0 commit comments

Comments
 (0)