1. 13 Sep, 2024 7 commits
    • Enable type-safe interoperability between different independent Python/C++… · a5fcc560
      Enable type-safe interoperability between different independent Python/C++ bindings systems. (#5296)
      
      * `self.__cpp_transporter__()` proof of concept: Enable passing C++ pointers across extensions even if the `PYBIND11_INTERNALS_VERSION`s do not match.
      
      * Include cleanup (mainly to resolve PyPy build failures).
      
      * Fix clang-tidy errors.
      
      * Resolve `error: extra
      
      * factor out platform_abi_id.h from internals.h (no functional changes)
      
      * factor out internals_version.h from internals.h (no functional changes)
      
      * Update CMakeLists.txt, tests/extra_python_package/test_files.py
      
      * Revert "factor out internals_version.h from internals.h (no functional changes)"
      
      This reverts commit 3ccea8cd4302cfaf2b6842f77ee3a2eefd61182a.
      
      * Remove internals_version.h from CMakeLists.txt, tests/extra_python_package/test_files.py
      
      * `.__cpp_transporter__()` implementation: compare `pybind11_platform_abi_id`, `cpp_typeid_name`
      
      * Add PremiumTraveler
      
      * Rename test_cpp_transporter_traveler_type.h -> test_cpp_transporter_traveler_types.h
      
      * Expand tests: `PremiumTraveler`, `get_points()`
      
      * Shuffle order of tests (no real changes).
      
      * Move `__cpp_transporter__` lambda to `py::cpp_transporter()` regular function.
      
      * Use `type_caster_generic::load(self)` instead of `cast<T *>(self)`
      
      * Pass `const std::type_info *` via `py::capsule` (instead of `cpp_typeid_name`).
      
      * Make platform_abi_id.h completely stand-alone.
      
      * rename exo_planet.cpp -> exo_planet_pybind11.cpp
      
      * Add exo_planet_c_api.cpp (incomplete).
      
      * Fix silly oversight (wrong filename in `#include`).
      
      * Resolve clang-tidy errors:
      
      ```
      /__w/pybind11/pybind11/tests/exo_planet_c_api.cpp:10:18: error: 'wrapGetLuggage' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace,-warnings-as-errors]
         10 | static PyObject *wrapGetLuggage(PyObject *, PyObject *) { return PyUnicode_FromString("TODO"); }
            | ~~~~~~           ^
      /__w/pybind11/pybind11/tests/exo_planet_c_api.cpp:14:20: error: 'ThisMethodDef' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace,-warnings-as-errors]
         14 | static PyMethodDef ThisMethodDef[]
            | ~~~~~~             ^
      /__w/pybind11/pybind11/tests/exo_planet_c_api.cpp:17:27: error: 'ThisModuleDef' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace,-warnings-as-errors]
         17 | static struct PyModuleDef ThisModuleDef = {
            | ~~~~~~                    ^
      ```
      
      * Implement exo_planet_c_api GetLuggage(), GetPoints()
      
      * Move new code from test_cpp_transporter_traveler_bindings.h to pybind11/detail/type_caster_base.h, under the name `class_dunder_cpp_transporter()`
      
      * Fix oversight.
      
      * Unconditionally add `__cpp_transporter__` method to all `py::class_` objects, but do not include that magic method in docstring signatures.
      
      * Back out pybind11/detail/platform_abi_id.h for now. Maximizing reusability can be handled separately, later.
      
      * Small cleanup.
      
      * Restore and add to `test_call_cpp_transporter_*()`
      
      * Ensure https://github.com/pybind/pybind11/issues/3788 does not bite again.
      
      * `class_dunder_cpp_transporter()`: replace `obj.cast<std::string>()` with `std::string(obj)`
      
      * Add (simple) copyright notices in all newly added files.
      
      * Globally replace cpp_transporter with cpp_conduit
      
      * style: pre-commit fixes
      
      * IWYU fixes
      
      * Rename `class_dunder_cpp_conduit()` -> `cpp_conduit_method()`
      
      * Change `pybind11_platform_abi_id`, `pointer_kind` argument types from `str` to `bytes`.
      
      This avoids the unicode decode/encode roundtrips:
      
      * More robust (no decode/encode errors).
      
      * Minor runtime optimization.
      
      * Systematically rename `cap_cpp_type_info` -> `cpp_type_info_capsule` (no functional changes).
      
      * Systematically replace `cpp_type_info_capsule` `name`: `"const std::type_info *"` -> `typeid(std::type_info).name()` (this IS a functional change).
      
      This provides an extra layer of protection against C++ ABI mismatches:
      
      * The first and most important layer is that the `PYBIND11_PLATFORM_ABI_ID`s must match between extensions.
      
      * The second layer is that the `typeid(std::type_info).name()`s must match between extensions.
      
      * Fix sort order accident in tests/CMakeLists.txt
      
      * Apply suggestions from code review
      
      Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
      
      * style: pre-commit fixes
      
      * refactor: rename to _pybind_conduit_v1_
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * Add test_home_planet_wrap_very_lonely_traveler(), test_exo_planet_pybind11_wrap_very_lonely_traveler()
      
      * Resolve clang-tidy errors:
      
      ```
      /__w/pybind11/pybind11/tests/test_cpp_conduit_traveler_bindings.h:39:32: error: parameter 'm' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param,-warnings-as-errors]
         10 |     py::class_<LonelyTraveler>(m, "LonelyTraveler");
            |                                ^
            |                                std::move( )
      /__w/pybind11/pybind11/tests/test_cpp_conduit_traveler_bindings.h:43:52: error: parameter 'm' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param,-warnings-as-errors]
         43 |     py::class_<VeryLonelyTraveler, LonelyTraveler>(m, "VeryLonelyTraveler");
            |                                                    ^
            |                                                    std::move( )
      ```
      
      ---------
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
      Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
      Ralf W. Grosse-Kunstleve committed
    • chore(deps): bump the actions group with 2 updates (#5361) · 54ab4249
      Bumps the actions group with 2 updates: [deadsnakes/action](https://github.com/deadsnakes/action) and [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance).
      
      
      Updates `deadsnakes/action` from 3.1.0 to 3.2.0
      - [Release notes](https://github.com/deadsnakes/action/releases)
      - [Commits](https://github.com/deadsnakes/action/compare/v3.1.0...v3.2.0)
      
      Updates `actions/attest-build-provenance` from 1.4.2 to 1.4.3
      - [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/attest-build-provenance/compare/6149ea5740be74af77f260b9db67e633f6b0a9a1...1c608d11d69870c2092266b3f9a6f3abbf17002c)
      
      ---
      updated-dependencies:
      - dependency-name: deadsnakes/action
        dependency-type: direct:production
        update-type: version-update:semver-minor
        dependency-group: actions
      - dependency-name: actions/attest-build-provenance
        dependency-type: direct:production
        update-type: version-update:semver-patch
        dependency-group: actions
      ...
      
      Signed-off-by: dependabot[bot] <support@github.com>
      Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
      dependabot[bot] committed
    • chore(deps): update pre-commit hooks (#5350) · 36ee4674
      * chore(deps): update pre-commit hooks
      
      updates:
      - [github.com/astral-sh/ruff-pre-commit: v0.5.6 → v0.6.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.6...v0.6.3)
      - [github.com/pre-commit/mirrors-mypy: v1.11.1 → v1.11.2](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.1...v1.11.2)
      - [github.com/sirosen/texthooks: 0.6.6 → 0.6.7](https://github.com/sirosen/texthooks/compare/0.6.6...0.6.7)
      - [github.com/PyCQA/pylint: v3.2.6 → v3.2.7](https://github.com/PyCQA/pylint/compare/v3.2.6...v3.2.7)
      - [github.com/python-jsonschema/check-jsonschema: 0.29.1 → 0.29.2](https://github.com/python-jsonschema/check-jsonschema/compare/0.29.1...0.29.2)
      
      * style: pre-commit fixes
      
      ---------
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      pre-commit-ci[bot] committed
    • Properly translate C++ exception to Python exception when creating Python buffer… · 9e6a67d5
      Properly translate C++ exception to Python exception when creating Python buffer from wrapped object (#5324)
      
      * Add test for throwing def_buffer case
      
      * Translate C++ -> Python exceptions in buffer creation
      
      This required a little refactoring to extract exception translation to a separate method
      
      * Fix code formatting
      
      * Fix "unused parameter" warning
      
      * Refactor per review
      
      * style: pre-commit fixes
      
      * Address review comments
      
      * Address review comments
      
      ---------
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      Vasily Litvinov committed
    • fix: using `__cpp_nontype_template_args` instead of… · b9f85757
      fix: using `__cpp_nontype_template_args` instead of `__cpp_nontype_template_parameter_class` (#5330)
      
      * fix: use `__cpp_nontype_template_args` instead of gnu extensions
      
      * fix: add feature test value
      
      * fix: change `PYBIND11_TYPING_H_HAS_STRING_LITERAL` skip reason
      ObeliskGate committed
    • chore(deps): bump actions/attest-build-provenance in the actions group (#5335) · 0a96ff7e
      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.1 to 1.4.2
      - [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/attest-build-provenance/compare/310b0a4a3b0b78ef57ecda988ee04b132db73ef8...6149ea5740be74af77f260b9db67e633f6b0a9a1)
      
      ---
      updated-dependencies:
      - dependency-name: actions/attest-build-provenance
        dependency-type: direct:production
        update-type: version-update:semver-patch
        dependency-group: actions
      ...
      
      Signed-off-by: dependabot[bot] <support@github.com>
      Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
      dependabot[bot] committed
  2. 22 Aug, 2024 6 commits
    • chore: prepare for 2.13.5 · 7c33cdc2
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • docs: prepare for 2.13.5 (#5327) · b3f5f2e7
      * docs: prepare for 2.13.5
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * Update docs/changelog.rst
      
      ---------
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • docs: clarify requirements for including pybind11 (#5326) · a4f6627d
      * DOC: Clarify requirements for including pybind11
      
      Inherited from requirements for including Python.h
      
      Closes #4999
      
      * style: pre-commit fixes
      
      ---------
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      DWesl committed
    • fix: allow -Wpedantic in C++20 mode (#5322) · 0d21cadc
      * fix: allow -Wpedantic again
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * tests: ignore pedantic warning for PYBIND11_DECLARE_HOLDER_TYPE
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * tests: try just turning off pedantic for one file
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * tests: only run pedantic in C++20 mode
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * Update tests/local_bindings.h
      
      ---------
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • fix: `<ranges>` support for `py::tuple` and `py::list` (#5314) · ff3ca786
      * feat: add `<ranges>` support for `py::tuple` and `py::list`
      
      * fix: format the code
      
      * fix: disable `ranges` in clang < 16
      
      * refactor: move `<ranges>` test macro to `test_pytypes.h`
      
      * refactor: seperate `ranges` test into 3 funcs
      
      * style: compress the if statement
      
      * style: pre-commit fixes
      
      * style: better formatting
      
      ---------
      
      Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      ObeliskGate committed
    • fix: never use `..` in a header include (#5321) · b0050f30
      * fix: never use `..` in a header include
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * fix: one more parent include
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      ---------
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
  3. 15 Aug, 2024 2 commits
  4. 14 Aug, 2024 3 commits
  5. 13 Aug, 2024 22 commits
    • chore: prepare for 2.13.3 · bd676436
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • docs: prepare for 2.13.3 · 7662af69
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • fix: quote paths from pybind11-config (#5302) · 45eaee91
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • fix: emscripten cmake issue (#5301) · 835139f5
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • chore: prepare for 2.13.2 · 07f30430
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • docs: prepare for 2.13.2 (#5299) · 6d5704cd
      * docs: prepare for 2.13.2
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * Update changelog.rst
      
      * Update changelog.rst
      
      ---------
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • chore(deps): bump actions/attest-build-provenance in the actions group (#5297) · 6ee574fa
      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.0 to 1.4.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/attest-build-provenance/compare/210c1913531870065f03ce1f9440dd87bc0938cd...310b0a4a3b0b78ef57ecda988ee04b132db73ef8)
      
      ---
      updated-dependencies:
      - dependency-name: actions/attest-build-provenance
        dependency-type: direct:production
        update-type: version-update:semver-patch
        dependency-group: actions
      ...
      
      Signed-off-by: dependabot[bot] <support@github.com>
      Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
      dependabot[bot] committed
    • fix(cmake): add required emscripten flags (#5298) · d8fcfe34
      * fix(cmake): add required emscripten flags
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * Update emscripten.yaml
      
      * fix(cmake): add required emscripten flags to headers target
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * fix(cmake): incorrect detection of Emscripten
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * fix(cmake): allow pybind11::headers to be modified
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * fix(cmake): hide a warning when building the tests standalone
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * fix(cmake): use explicit variable for is config
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * fix(cmake): go back to ALIAS target
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * chore: reduce overall diff
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * chore: reduce overall diff
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * chore: shorten code a bit
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      ---------
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • Add `type_caster_std_function_specializations` feature. (#4597) · 78e26321
      * Allow specializations based on callback function return values.
      
      * clang-tidy auto fix
      
      * Add a test case for function specialization.
      
      * Add test for callback function that raises Python exception.
      
      * Fix test failures.
      
      * style: pre-commit fixes
      
      * Add `#define PYBIND11_HAS_TYPE_CASTER_STD_FUNCTION_SPECIALIZATIONS`
      
      ---------
      
      Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      Xiaofei Wang committed
    • chore(deps): update pre-commit hooks (#5288) · 44d0d9a4
      updates:
      - [github.com/astral-sh/ruff-pre-commit: v0.5.0 → v0.5.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.0...v0.5.6)
      - [github.com/pre-commit/mirrors-mypy: v1.10.1 → v1.11.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.1...v1.11.1)
      - [github.com/PyCQA/pylint: v3.2.4 → v3.2.6](https://github.com/PyCQA/pylint/compare/v3.2.4...v3.2.6)
      - [github.com/python-jsonschema/check-jsonschema: 0.28.6 → 0.29.1](https://github.com/python-jsonschema/check-jsonschema/compare/0.28.6...0.29.1)
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      pre-commit-ci[bot] committed
    • chore(deps): bump the actions group with 2 updates (#5287) · fe808a01
      Bumps the actions group with 2 updates: [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) and [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance).
      
      
      Updates `pypa/cibuildwheel` from 2.19 to 2.20
      - [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.19...v2.20)
      
      Updates `actions/attest-build-provenance` from 1.3.3 to 1.4.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/attest-build-provenance/compare/5e9cb68e95676991667494a6a4e59b8a2f13e1d0...210c1913531870065f03ce1f9440dd87bc0938cd)
      
      ---
      updated-dependencies:
      - dependency-name: pypa/cibuildwheel
        dependency-type: direct:production
        update-type: version-update:semver-minor
        dependency-group: actions
      - dependency-name: actions/attest-build-provenance
        dependency-type: direct:production
        update-type: version-update:semver-minor
        dependency-group: actions
      ...
      
      Signed-off-by: dependabot[bot] <support@github.com>
      Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
      dependabot[bot] committed
    • clang-tidy upgrade (to version 18) (#5272) · 042c3cfd
      * `container: silkeh/clang:18-bookworm` in .github/workflows/format.yml
      
      * clang-tidy auto-fix (trivial, in test only)
      
      * Disable `performance-enum-size` (noisy, low value)
      
      * Temporarily turn off 3 diagnostics (to be tackled one-by-one).
      
      * Add explicit `switch` `default` to resolve clang-tidy `bugprone-switch-missing-default-case`
      
      Debian clang version 18.1.8 (++20240718080534+3b5b5c1ec4a3-1~exp1~20240718200641.143)
      Target: x86_64-pc-linux-gnu
      
      tests/test_numpy_dtypes.cpp:212:5: warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
      
      * Add clang-17 and clang-18 testing.
      
      * Add `NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)` in test_tagbased_polymorphic.cpp
      
      Debian clang version 18.1.8 (++20240718080534+3b5b5c1ec4a3-1~exp1~20240718200641.143)
      Target: x86_64-pc-linux-gnu
      
      tests/test_tagbased_polymorphic.cpp:77:40: warning: The value '150' provided to the cast expression is not in the valid range of values for 'Kind' [clang-analyzer-optin.core.EnumCastOutOfRange]
      
      * Fix inconsistent pybind11/eigen/tensor.h behavior:
      
      This existing comment in pybind11/eigen/tensor.h
      
      ```
                      // move, take_ownership don't make any sense for a ref/map:
      ```
      
      is at odds with the `delete src;` three lines up.
      
      In real-world client code `take_ownership` will not exist (unless the client code is untested and unused). I.e. the `delete` is essentially only useful to avoid leaks in the pybind11 unit tests.
      
      While upgrading to clang-tidy 18, the warning below appeared. Apparently it is produced during LTO, and it appears difficult to suppress. Regardless, the best way to resolve this is to remove the `delete` and to simply make the test objects `static` in the unit test code.
      
      ________
      
      Debian clang version 18.1.8 (++20240718080534+3b5b5c1ec4a3-1~exp1~20240718200641.143)
      Target: x86_64-pc-linux-gnu
      ________
      
      ```
      lto-wrapper: warning: using serial compilation of 3 LTRANS jobs
      lto-wrapper: note: see the ‘-flto’ option documentation for more information
      In function ‘cast_impl’,
          inlined from ‘cast’ at /mounted_pybind11/include/pybind11/eigen/tensor.h:414:25,
          inlined from ‘operator()’ at /mounted_pybind11/include/pybind11/eigen/../pybind11.h:296:40,
          inlined from ‘_FUN’ at /mounted_pybind11/include/pybind11/eigen/../pybind11.h:267:21:
      /mounted_pybind11/include/pybind11/eigen/tensor.h:475:17: warning: ‘operator delete’ called on unallocated object ‘<anonymous>’ [-Wfree-nonheap-object]
        475 |                 delete src;
            |                 ^
      /mounted_pybind11/include/pybind11/eigen/../pybind11.h: In function ‘_FUN’:
      /mounted_pybind11/include/pybind11/eigen/../pybind11.h:297:75: note: declared here
        297 |                     std::move(args_converter).template call<Return, Guard>(cap->f),
            |                                                                           ^
      ```
      
      * Disable `bugprone-chained-comparison`: this clang-tidy check is incompatible with the Catch2 `REQUIRE` macro (26 warnings like the one below).
      ________
      
      Debian clang version 18.1.8 (++20240718080534+3b5b5c1ec4a3-1~exp1~20240718200641.143)
      Target: x86_64-pc-linux-gnu
      ________
      
      ```
      /mounted_pybind11/tests/test_embed/test_interpreter.cpp:127:9: warning: chained comparison 'v0 <= v1 == v2' may generate unintended results, use parentheses to specify order of evaluation or a logical operator to separate comparison expressions [bugprone-chained-comparison]
        127 |         REQUIRE(ret == 42);
            |         ^
      /build/tests/catch/catch.hpp:17670:24: note: expanded from macro 'REQUIRE'
       17670 | #define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__  )
             |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /build/tests/catch/catch.hpp:2710:47: note: expanded from macro 'INTERNAL_CATCH_TEST'
       2710 |             catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \
            |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /mounted_pybind11/tests/test_embed/test_interpreter.cpp:127:9: note: operand 'v0' is here
        127 |         REQUIRE(ret == 42);
            |         ^
      /build/tests/catch/catch.hpp:17670:24: note: expanded from macro 'REQUIRE'
       17670 | #define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__  )
             |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /build/tests/catch/catch.hpp:2710:47: note: expanded from macro 'INTERNAL_CATCH_TEST'
       2710 |             catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \
            |                                               ^~~~~~~~~~~~~~~~~~~
      /mounted_pybind11/tests/test_embed/test_interpreter.cpp:127:17: note: operand 'v1' is here
        127 |         REQUIRE(ret == 42);
            |                 ^
      /build/tests/catch/catch.hpp:17670:90: note: expanded from macro 'REQUIRE'
       17670 | #define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__  )
             |                                                                                          ^~~~~~~~~~~
      /build/tests/catch/catch.hpp:2710:70: note: expanded from macro 'INTERNAL_CATCH_TEST'
       2710 |             catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \
            |                                                                      ^~~~~~~~~~~
      /mounted_pybind11/tests/test_embed/test_interpreter.cpp:127:24: note: operand 'v2' is here
        127 |         REQUIRE(ret == 42);
            |                        ^
      /build/tests/catch/catch.hpp:17670:90: note: expanded from macro 'REQUIRE'
       17670 | #define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__  )
             |                                                                                          ^~~~~~~~~~~
      /build/tests/catch/catch.hpp:2710:70: note: expanded from macro 'INTERNAL_CATCH_TEST'
       2710 |             catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \
            |                                                                      ^~~~~~~~~~~
      ```
      
      * Add 8 `// NOLINT(bugprone-empty-catch)`
      
      * Resolve clang-tidy `bugprone-multi-level-implicit-pointer-conversion` warnings.
      ________
      Debian clang version 18.1.8 (++20240718080534+3b5b5c1ec4a3-1~exp1~20240718200641.143)
      Target: x86_64-pc-linux-gnu
      ________
      ```
      pybind11/detail/internals.h:556:53: warning: multilevel pointer conversion from 'internals **' to 'const void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
      
      pybind11/detail/type_caster_base.h:431:20: warning: multilevel pointer conversion from 'void **' to 'void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
      
      pybind11/numpy.h:904:81: warning: multilevel pointer conversion from '_object *const *' to 'const void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
      pybind11/numpy.h:1989:39: warning: multilevel pointer conversion from 'typename vectorize_arg<const double *>::type *' (aka 'const double **') to 'void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
      pybind11/numpy.h:1989:39: warning: multilevel pointer conversion from 'typename vectorize_arg<const VectorizeTestClass *>::type *' (aka 'const VectorizeTestClass **') to 'void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
      
      pybind11/stl/filesystem.h:75:44: warning: multilevel pointer conversion from 'PyObject **' (aka '_object **') to 'void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
      pybind11/stl/filesystem.h:83:42: warning: multilevel pointer conversion from 'PyObject **' (aka '_object **') to 'void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
      ```
      
      * Introduce `PYBIND11_REINTERPRET_CAST_VOID_PTR_IF_NOT_PYPY` to resolve PyPy build errors:
      
      ```
      In file included from /Users/runner/work/pybind11/pybind11/tests/test_stl.cpp:18:
      /Users/runner/work/pybind11/pybind11/include/pybind11/stl/filesystem.h:75:17: error: no matching function for call to 'PyPyUnicode_FSConverter'
                  if (PyUnicode_FSConverter(buf, reinterpret_cast<void *>(&native)) != 0) {
                      ^~~~~~~~~~~~~~~~~~~~~
      /Users/runner/hostedtoolcache/PyPy/3.10.14/x64/include/pypy3.10/pypy_decl.h:969:31: note: expanded from macro 'PyUnicode_FSConverter'
                                    ^~~~~~~~~~~~~~~~~~~~~~~
      /Users/runner/hostedtoolcache/PyPy/3.10.14/x64/include/pypy3.10/pypy_decl.h:970:17: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'struct _object **' for 2nd argument
      PyAPI_FUNC(int) PyUnicode_FSConverter(struct _object *arg0, struct _object **arg1);
                      ^
      /Users/runner/hostedtoolcache/PyPy/3.10.14/x64/include/pypy3.10/pypy_decl.h:969:31: note: expanded from macro 'PyUnicode_FSConverter'
                                    ^
      In file included from /Users/runner/work/pybind11/pybind11/tests/test_stl.cpp:18:
      /Users/runner/work/pybind11/pybind11/include/pybind11/stl/filesystem.h:83:17: error: no matching function for call to 'PyPyUnicode_FSDecoder'
                  if (PyUnicode_FSDecoder(buf, reinterpret_cast<void *>(&native)) != 0) {
                      ^~~~~~~~~~~~~~~~~~~
      /Users/runner/hostedtoolcache/PyPy/3.10.14/x64/include/pypy3.10/pypy_decl.h:971:29: note: expanded from macro 'PyUnicode_FSDecoder'
                                  ^~~~~~~~~~~~~~~~~~~~~
      /Users/runner/hostedtoolcache/PyPy/3.10.14/x64/include/pypy3.10/pypy_decl.h:972:17: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'struct _object **' for 2nd argument
      PyAPI_FUNC(int) PyUnicode_FSDecoder(struct _object *arg0, struct _object **arg1);
                      ^
      /Users/runner/hostedtoolcache/PyPy/3.10.14/x64/include/pypy3.10/pypy_decl.h:971:29: note: expanded from macro 'PyUnicode_FSDecoder'
                                  ^
      ```
      
      * clang-tidy auto-fix
      
      * Fix silly oversight.
      Ralf W. Grosse-Kunstleve committed
    • docs: remove outdated known limitation. (#5263) · 667563dd
      * Fix typo.
      
      * Remove outdated known limitation.
      
      See #5179.
      Theodore Tsirpanis committed
    • Small cleanup/refactoring in support of PR #5213 (#5251) · 129934ad
      * Factor out detail/value_and_holder.h (from detail/type_caster_base.h)
      
      This is in support of PR #5213:
      
      * trampoline_self_life_support.h depends on value_and_holder.h
      
      * type_caster_base.h depends on trampoline_self_life_support.h
      
      * Fix a minor and inconsequential inconsistency in `copyable_holder_caster`: the correct `load_value()` return type is `void` (as defined in `type_caster_generic`)
      
      For easy future reference, this is the long-standing inconsistency:
      
      * https://github.com/pybind/pybind11/blob/dbf848aff7c37ef8798bc9459a86193e28b1032f/include/pybind11/detail/type_caster_base.h#L634
      
      * https://github.com/pybind/pybind11/blob/dbf848aff7c37ef8798bc9459a86193e28b1032f/include/pybind11/cast.h#L797
      
      Noticed in passing while working on PR #5213.
      
      * Add `DANGER ZONE` comment in detail/init.h, similar to a comment added on the smart_holder branch (all the way back in 2021).
      Ralf W. Grosse-Kunstleve committed
    • tests: run on pyodide (#4745) · f50830ea
      * tests: run on pyodide
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * ci: use cibuildwheel for pyodide test
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      * tests: revert changes to test_embed
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      
      ---------
      
      Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
      Henry Schreiner committed
    • docs: extend `PYBIND11_MODULE` documentation, mention `mod_gil_not_used` (#5250) · b4307453
      This follows up on PR 5148, which introduced support for free-threaded CPython.
      Ralf Gommers committed
    • fix: make gil_safe_call_once thread-safe in free-threaded CPython (#5246) · f3a6d414
      * fix: Make gil_safe_call_once thread-safe in free-threaded CPython
      
      The "is_initialized_" flags is not protected by the GIL in free-threaded
      Python, so it needs to be an atomic field.
      
      Fixes #5245
      
      * style: pre-commit fixes
      
      * Apply changes from code review
      
      ---------
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      Sam Gross committed
    • chore(deps): bump actions/attest-build-provenance in the actions group (#5243) · d699e99c
      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.3.2 to 1.3.3
      - [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/attest-build-provenance/compare/bdd51370e0416ac948727f861e03c2f05d32d78e...5e9cb68e95676991667494a6a4e59b8a2f13e1d0)
      
      ---
      updated-dependencies:
      - dependency-name: actions/attest-build-provenance
        dependency-type: direct:production
        update-type: version-update:semver-patch
        dependency-group: actions
      ...
      
      Signed-off-by: dependabot[bot] <support@github.com>
      Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
      dependabot[bot] committed
    • chore(deps): bump certifi from 2024.2.2 to 2024.7.4 in /docs (#5226) · 4b2f7cd6
      Bumps [certifi](https://github.com/certifi/python-certifi) from 2024.2.2 to 2024.7.4.
      - [Commits](https://github.com/certifi/python-certifi/compare/2024.02.02...2024.07.04)
      
      ---
      updated-dependencies:
      - dependency-name: certifi
        dependency-type: indirect
      ...
      
      Signed-off-by: dependabot[bot] <support@github.com>
      Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
      dependabot[bot] committed
    • Use PyMutex instead of std::mutex in free-threaded build. (#5219) · 8443d084
      * Use PyMutex instead of std::mutex in free-threaded build.
      
      PyMutex is now part of the public C API as of 3.13.0b3 and generally has
      slightly less overhead than std::mutex.
      
      * style: pre-commit fixes
      
      * Fix instance_map_shard padding
      
      ---------
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      Sam Gross committed
    • chore(deps): update pre-commit hooks (#5220) · 41726b64
      updates:
      - [github.com/pre-commit/mirrors-clang-format: v18.1.5 → v18.1.8](https://github.com/pre-commit/mirrors-clang-format/compare/v18.1.5...v18.1.8)
      - [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.5.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.7...v0.5.0)
      - [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.10.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.0...v1.10.1)
      - [github.com/adamchainz/blacken-docs: 1.16.0 → 1.18.0](https://github.com/adamchainz/blacken-docs/compare/1.16.0...1.18.0)
      - [github.com/PyCQA/pylint: v3.2.2 → v3.2.4](https://github.com/PyCQA/pylint/compare/v3.2.2...v3.2.4)
      - [github.com/python-jsonschema/check-jsonschema: 0.28.4 → 0.28.6](https://github.com/python-jsonschema/check-jsonschema/compare/0.28.4...0.28.6)
      
      Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
      pre-commit-ci[bot] committed