Sync `Py_TPFLAGS_MANAGED_DICT` for PyPy3.11 across the codebase (#5537)* Sync `Py_TPFLAGS_MANAGED_DICT` for PyPy3.11 across the codebase
Adjust the `Py_TPFLAGS_MANAGED_DICT` logic in `include/pybind11/attr.h`
to match the one used in `include/pybind11/detail/class.h`.
This is a followup to #5508.
* Use a common `#define` for pre-`Py_TPFLAGS_MANAGED_DICT` Pythons
* style: pre-commit fixes
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bo...
Improved reference_internal documentation (#5528)* Improved reference_internal documentation
Improved the wording to make it easier to understand and added a note about the policy falling back to move if the return value is not an lvalue reference or pointer.
* Added bold and ticket number
Start pybind11v3: Remove all code for `PYBIND11_INTERNALS_VERSION`s `4` and `5` (#5530)* Start pybind11v3
* Remove all code for PYBIND11_INTERNALS_VERSION 4 and 5
* Fix oversight: pybind11/_version.py needs to be updated as well.
* Add @pytest.mark.skipif("env.GRAALPY", reason="TODO debug segfault")
Add `release_gil_before_calling_cpp_dtor` annotation for `class_` (#5522)* Backport of https://github.com/google/pybind11clif/pull/30088 (main PR) and https://github.com/google/pybind11clif/pull/30092 (minor fixes).
Note for completeness:
These are identical to the current versions on the pybind11clif main branch (@ commit 4841661df5daf26ecdedaace54e64d0782e63f64):
* test_class_release_gil_before_calling_cpp_dtor.cpp
* test_class_release_gil_before_calling_cpp_dt...
Remove some maybe-uninitialized warnings (#5516)* Remove some maybe-uninitialized warnings
In the Eigen matrix type_caster, resize the matrix instead of assigning with a new one when the matrix size needs to be adjusted.
This can remove lots of compiling warnings about "maybe-uninitialized".
* Revert "Remove some maybe-uninitialized warnings"
This reverts commit 7d5a9b41aaf6878f9ff27aa0fb68c6de4a409a01.
* Suppress `-Wmaybe-uninitialized...
chore(deps): bump seanmiddleditch/gha-setup-ninja in the actions group (#5509)Bumps the actions group with 1 update: [seanmiddleditch/gha-setup-ninja](https://github.com/seanmiddleditch/gha-setup-ninja).
Updates `seanmiddleditch/gha-setup-ninja` from 5 to 6
- [Release notes](https://github.com/seanmiddleditch/gha-setup-ninja/releases)
- [Commits](https://github.com/seanmiddleditch/gha-setup-ninja/compare/v5...v6)
---
updated-dependencies:
- dependency-name: seanmiddle...
chore(deps): bump actions/attest-build-provenance in the actions group (#5503)Bumps the actions group with 1 update: [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance).
Updates `actions/attest-build-provenance` from 2.1.0 to 2.2.0
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](https://github.com/actions/at...
chore(cmake): Add an author warning that auto-calculated `PYTHON_MODULE_EXTENSION` may not respect `SETUPTOOLS_EXT_SUFFIX` during cross-compilation (#5495)
feat: --extension-suffix for pybind11 command (#5360)* fix docs build command on different global and venv python versions
* feat: add --extension-suffix
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Nikul Patel <nikul@z830>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
fix(cmake): don't strip with BUILD_TYPE None (#5392)Debian builds with None by default and takes care of stripping itself.
This allows building debug symbol packages.
feat: rework of arg/return type hints to support .noconvert() (#5486)* Added rework of arg/return typing
* Changed `Path` to `pathlib.Path` for compatibility with pybind11-stubgen
* Removed old arg/return type hint implementation
* Added noconvert support for arg/return type hints
* Added commented failing tests for Literals with special characters
* Added return_descr/arg_descr for correct typing in typing::Callable
* Fixed clang-tidy issues
* Changed io...
Fix data race when using shared variables (free threading) (#5494)* Fix data race when using shared variables (free threading)
In the free threading build, there's a race between wrapper re-use and
wrapper deallocation. This can happen with a static variable accessed by
multiple threads.
Fixing this requires using some private CPython APIs: _Py_TryIncref and
_PyObject_SetMaybeWeakref. The implementations of these functions are
included until they're made av...
Fix module type hint (#5469)* Fix module type hint
"module" is not a valid python value.
The correct type hint for a module object is "types.ModuleType" which has existed since at least Python 2.6
* Added module type hint test
* style: pre-commit fixes
* Remove doc function
* Fixed type hint
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
chore(deps): bump actions/attest-build-provenance in the actions group (#5468)Bumps the actions group with 1 update: [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance).
Updates `actions/attest-build-provenance` from 2.0.1 to 2.1.0
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](https://github.com/actions/at...
`PYBIND11_PLATFORM_ABI_ID` Modernization Continued (platforms other than MSVC) (#5439)* THIS IS JUST A START: First attempt to combine information from PR #4953 and PR #5437
* Include GXX_ABI and USE_CXX in the identifier
Further constrain to GXX_ABI 1002 or greater and less than 2000,
hopefully future proof by summarizing that as `1` along with CXX11 on or
off.
* style: pre-commit fixes
* Use `gxx_abi_1xxx` and simplify the Clang string
After discussions with Ralf Grosse-K...
chore(deps): bump actions/attest-build-provenance in the actions group (#5461)Bumps the actions group with 1 update: [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance).
Updates `actions/attest-build-provenance` from 1.4.4 to 2.0.1
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](https://github.com/actions/at...
Option for arg/return type hints and correct typing for std::filesystem::path (#5450)* Added arg/return type handling.
* Added support for nested arg/return type in py::typing::List
* Added support for arg/return type in stl/filesystem
* Added tests for arg/return type in stl/filesystem and py::typing::List
* Added arg/return name to more py::typing classes
* Added arg/return type to Callable[...]
* Added tests for typing container classes (also nested)
* Changed typing ...
chore(deps): bump pypa/cibuildwheel in the actions group (#5451)Bumps the actions group with 1 update: [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel).
Updates `pypa/cibuildwheel` from 2.21 to 2.22
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.21...v2.22)
---
updated-dependencies:
- depen...
Add support for array_t<handle> and array_t<object> (#5427)* Add support for array_t<handle> and array_t<object>
* style: pre-commit fixes
* Remove loops that aren't strictly needed
* Fix compiler warning
* Disable GC-dependent checks when running on pypy or graalpy
* style: pre-commit fixes
* Remove PyValueHolder counter again
* Move tests to templates to avoid code duplication
* Rerun pre-commit
* Restore import that was erroneously removed ...
chore(deps): bump actions/attest-build-provenance in the actions group (#5440)Bumps the actions group with 1 update: [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance).
Updates `actions/attest-build-provenance` from 1.4.3 to 1.4.4
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](https://github.com/actions/at...
feat(typing): allow annotate methods with `pos_only` when only have the `self` argument (#5403)* feat: allow annotate methods with `pos_only` when only have the `self` argument
* chore(typing): make arguments for auto-generated dunder methods positional-only
* docs: add more comments to improve readability
* style: fix nit suggestions
* Add test_self_only_pos_only() in tests/test_methods_and_attributes
* test: add docstring tests for generated dunder methods
* test: remove failed t...
Add type hints for args and kwargs (#5357)* Allow subclasses of args and kwargs
The current implementation disallows subclasses of args and kwargs
* Added object type hint to args and kwargs
* Added type hinted args and kwargs classes
* Changed default type hint to typing.Any
* Removed args and kwargs type hint
* Updated tests
Modified the tests from #5381 to use the real Args and KWArgs classes
* Added comment
Factor out pybind11/conduit/pybind11_platform_abi_id.h (#5375)* Factor out pybind11/compat/wrap_include_python_h.h
* Fixes to resolve tests_packaging failures.
* Factor out pybind11/compat/pybind11_platform_abi_id.h
* Add pybind11/compat/README.txt and a couple source code comments.
* Minor changes to comments.
* Factor out pybind11/compat/pybind11_conduit_v1.h
* Add long comment to pybind11/compat/pybind11_conduit_v1.h
* Add pybind11/compat/README...
Fix MSVC MT/MD incompatibility in PYBIND11_BUILD_ABI (#4953)* Fix MSVC MT/MD incompatibility in PYBIND11_BUILD_ABI
* Update comment about which PR
* Use msvc major version
* Use _MSC_VER/100
* Fix figuring out MD vs MT
* Add some test runs
* Skip one test
* Fix preprocessor
* simplify code
* fix if
* support only msvc 19
* Fold in changes from experimental PR #5411. Polish error messages.
* Remove `&& defined(_DLL)` (TBD: is it needed? but w...
Fixed data race in all_type_info in free-threading mode (#5419)* Fix data race all_type_info_populate in free-threading mode
Description:
- fixed data race all_type_info_populate in free-threading mode
- added test
For example, we have 2 threads entering `all_type_info`.
Both enter `all_type_info_get_cache`` function and
there is a first one which inserts a tuple (type, empty_vector) to the map
and second is waiting. Inserting thread gets the (iter_to_key...
Fix buffer protocol implementation (#5407)* Fix buffer protocol implementation
According to the buffer protocol, `ndim` is a _required_ field [1], and
should always be set correctly. Additionally, `shape` should be set if
flags includes `PyBUF_ND` or higher [2]. The current implementation only
set those fields if flags was `PyBUF_STRIDES`.
[1] https://docs.python.org/3/c-api/buffer.html#request-independent-fields
[2] https://docs.pyt...
Fix #5399: iterator increment operator does not skip first item (#5400)* Fix #5399: iterator increment operator does not skip first item
* Fix postfix increment operator: init() must be called before copying *this
docs/advanced A document about deadlock potential with C++ statics (#5394)* [docs/advanced] A document about deadlock potential with C++ statics
* [docs/advanced] Refer to deadlock.md from misc.rst
* [docs/advanced] Fix tables in deadlock.md
* Use :ref:`deadlock-reference-label`
* Revert "Use :ref:`deadlock-reference-label`"
This reverts commit e5734d275fa0d38ad4a58a595797353813e65df1.
* Add simple references to docs/advanced/deadlock.md filename. (Maybe someon...