Commit Graph

3109 Commits

Author SHA1 Message Date
Henry Schreiner
66d394f259 docs: standardize header a bit (#5749) 2025-07-11 13:51:17 -07:00
Ralf W. Grosse-Kunstleve
fa72aff53d [skip ci] Small docs/release.rst update, mainly to remove git push --tags. (#5748)
* [skip ci] Small docs/release.rst update, mainly to warn about `git push --tags`.

* Remove mention of `git push --tags`

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2025-07-11 13:49:30 -07:00
Ralf W. Grosse-Kunstleve
422990f842 chore: get back to work (after v3.0.0 release) (#5747)
* Change version on master to v3.0.1a0

* Fix up PYBIND11_VERSION_PATCH
2025-07-11 13:25:25 -07:00
Ralf W. Grosse-Kunstleve
ed5057ded6 chore: prepare for 3.0.0 (final) (#5746)
* Update docs/changelog.md and change version to v3.0.0 (final)

* [skip ci] Add `|SPEC 4 — Using and Creating Nightly Wheels|` badge in main README.rst
v3.0.0
2025-07-10 09:16:14 -07:00
Ralf W. Grosse-Kunstleve
4dc4aca2e1 [skip ci] Explain: conduit feature only covers from-Python-to-C++ conversions (#5740) 2025-06-20 13:23:26 -07:00
Henry Schreiner
03d8f48750 docs: fix typo in multiple_interpreters (#5738)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-19 11:46:03 -04:00
Henry Schreiner
ea3e33e40d chore: prepare for 3.0.0rc4 (#5736)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
v3.0.0rc4
2025-06-19 10:51:52 -04:00
dependabot[bot]
bdc56d9e2e chore(deps): bump urllib3 from 2.2.2 to 2.5.0 in /docs (#5735)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.2 to 2.5.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.2.2...2.5.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.5.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-19 00:16:25 -04:00
Henry Schreiner
cf3d1a75a2 feat: numpy scalars (#5726) 2025-06-18 19:40:31 -04:00
Michael Šimáček
c60c14991d tests: handle 3.12 and 3.13 implementations and 3.14.0b3+ (#5732)
* Use pytest.importorskip to get _xxsubinterpreters

* tests: use modern interpreter API

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: try to fix beta2

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: remove debug printout

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: drop useless checks

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: improve check for 3.14.0b3 and b4+

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-06-18 18:51:27 -04:00
Henry Schreiner
be507b725b ci: check latest on 3.13 (#5734)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-18 11:34:50 -04:00
b-pass
f2c0ab83bc Fix TSan warning in sub-interpreter test (#5729) 2025-06-17 20:50:30 -07:00
Henry Schreiner
ad9180c120 fix: android CMake support (#5733) 2025-06-17 20:04:52 -04:00
Ralf W. Grosse-Kunstleve
86e82ddbc2 Add support for shared_ptr<const T> in py::init() with smart_holder (#5731)
* Add overload to enable `.def(py::init(&rtrn_shcp))`. Also uncomment `.def(py::init(&rtrn_uqcp))` and `.def(py::init(&rtrn_udcp))`, which happen to work already (not sure what change in the past made those work).

* Introduce `construct_from_shared_ptr()` helper for DRY-ness.
2025-06-17 12:16:56 -07:00
Ralf W. Grosse-Kunstleve
365d41a4ba Eliminate cross-DSO RTTI reliance in smart_holder functionality (for platforms like macOS). (#5728)
* Revert PR #5700 production code change (pybind11/detail/struct_smart_holder.h).

```
git checkout b19489145b2c7a117138632d624809dfb3b380bb~1 include/pybind11/detail/struct_smart_holder.h
```

* Introduce `get_internals().get_memory_guarded_delete()`

* [skip ci] Only pass around `memory::get_guarded_delete` function pointer.

* [skip ci] Change a variable name for internal consistency. Add 3 x NOTE: PYBIND11_INTERNALS_VERSION needs to be bumped if changes are made to this struct.

* Add comment: get_internals().get_memory_guarded_delete does not need with_internals()

* Traverse all DSOs to find memory::guarded_delete with matching RTTI.

* Add nullptr check to dynamic_cast overload.

Suggested by ChatGPT for these reasons:

* Prevents runtime RTTI lookups on nullptr.

* Helps avoid undefined behavior if users pass in nulls from failed casts or optional paths.

* Ensures consistent return value semantics and no accidental access to vtable.

* Improve smart_holder unique_ptr deleter compatibility checks across DSOs:

* Replace RTTI-based detection of std::default_delete<T> with a constexpr check to avoid RTTI reliance

* Add type_info_equal_across_dso_boundaries() fallback using type_info::name() for RTTI equality across macOS DSOs

* Rename related flags and functions for clarity (e.g., builtin → std_default)

* Improves ABI robustness and clarity of ownership checks in smart_holder

* Trivial renaming for internal consistency: builtin_delete → std_default_delete

* Add get_trampoline_self_life_support to detail::type_info (passes local testing).

* Polish previous commit slightly.

* [skip ci] Store memory::get_guarded_delete in `detail::type_info` instead of `detail::internals` (no searching across DSOs required).

* Revert change suggested by ChatGPT. After double-checking, ChatGPT agrees this isn't needed.

* Minor polishing.
2025-06-17 12:14:50 -07:00
Jan Iwaszkiewicz
e2f86af216 docs: add documentation entry for warnings (#5356)
* [docs] Add entry for warnings

* Fix code formatting

* Update docs

* Fix issue with docs

* [skip ci] Minor edits.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2025-06-17 14:03:58 -04:00
Rosdf
f3bb00732d better test for const only smart ptr (#5727) 2025-06-14 08:38:09 -07:00
Henry Schreiner
d218b160a6 ci: avoid 3.13.4 on Windows (#5725) 2025-06-13 18:46:07 -04:00
dependabot[bot]
f8640da401 chore(deps): bump pypa/cibuildwheel from 3.0.0rc2 to 3.0 in the actions group (#5721)
* chore(deps): bump pypa/cibuildwheel in the actions group

Bumps the actions group with 1 update: [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel).


Updates `pypa/cibuildwheel` from 3.0.0rc2 to 3.0.0
- [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/v3.0.0rc2...v3.0.0)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 3.0.0
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update tests-cibw.yml

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2025-06-11 23:58:06 -04:00
Rosdf
7ed76e2d50 fix: add support for const-only smart pointers (#5718)
* add support for const pointers in smart pointers

* use c++11 compatible code

* add template parameter in test

* Make the const-removal clearly visible. This simplifies the production code changes significantly.

For background see: https://claude.ai/share/4085d9ab-a859-44cc-bb56-450e472f817a

* test without leaks

* add namespace for test

* rename test

* fix test compilation

* using namespace test_const_only_smart_ptr;

* fix smartptr in test

* smaller test body

* move test

* style: pre-commit fixes

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-06-11 12:32:26 -04:00
Henry Schreiner
513d1f962e ci: check iOS update (#5717) 2025-06-10 17:36:09 -04:00
dependabot[bot]
ff0e381d9e chore(deps): bump requests from 2.32.3 to 2.32.4 in /docs (#5720)
Bumps [requests](https://github.com/psf/requests) from 2.32.3 to 2.32.4.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.32.3...v2.32.4)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.32.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-10 17:35:50 -04:00
Xuehai Pan
6c5d25aae2 test: run pytest under Python devmode (#5715)
* test: run pytest under Python devmode

* test: skip segfault bug with 3.14.0b1/2

* test: skip segfault bug with 3.14.0b1/2

* test: unset CMAKE_BUILD_PARALLEL_LEVEL
2025-06-06 03:54:02 -04:00
Henry Schreiner
5d32ed76c0 docs: prepare for RC 3 (#5713)
* docs: prepare for RC 3

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* docs: one more rc 3 update

* chore: bump to 3.0.0rc3

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
v3.0.0rc3
2025-06-05 11:14:33 -04:00
Xuehai Pan
c786d34f60 fix: handle null py::handle and add tests for py::scoped_critical_section (#5706)
* chore: handle null for `py::scoped_critical_section`

* test: add tests for `py::scoped_critical_section`

* test: use assert instead of REQUIRE

* feat: enable faulthandler for pytest

* chore: use `__has_include(<barrier>)`

* fix: fix segmentation fault in test

* fix: test critical_section for no-gil only

* test: run new tests only

* test: ensure non-empty test selection

* fix: fix test critical_section

* fix: change Python 3.14.0b1/2 xfail tests to non-strict

* test: trigger gc manually

* test: mark xfail to `DynamicClass`

* Use `namespace test_scoped_critical_section_ns` (standard approach to guard against name clashes).

* Simplify changes in pybind11/critical_section.h and add test_nullptr_combinations()

* test: disable Python devmode in pytest

* test: add comprehensive comments for the tests

* test: add a summary comment for tests

* refactor: simpler impl

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-04 11:45:26 -04:00
b-pass
c7026d0d1c fix!: modify the internals pointer-to-pointer implementation to not use thread_local (#5709)
* Refactor internals to use a holder that manages the PP

* Refactor internals to use a holder that manages the PP

* Fix cleanup/destruction issues.

* Fix one more destruction issue

Should now just be able to delete the internals PP on destruction

* Make clang-tidy happy

* Try to fix exception translators issue on certain platforms

Also fix a couple more pedantic warings

* Fix test, after internals is free'd it can come back at the same address

So instead, just make sure it was zero'd and don't try to compare the addresses.

Also a little code cleanup

* Comment tweak [skip ci]

* Switch to ifdef instead of if

* Re-enable subinterpreters in iOS

* style: pre-commit fixes

* Oops, this snuck in on merge

* fix: bump ABI version to 10

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.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>
2025-06-03 16:02:44 -04:00
Peter Steneteg
b19489145b fix: expose required symbol using clang (#5700)
* test: Added test case for visibility of common symbols across shared libraries

* style: pre-commit fixes

* tests: cmake target name fix

* tests: Added visibility test to ci

* tests: set the default visibility to hidden

* prototype/proof-of-concept fix: PYBIND11_EXPORT_GUARDED_DELETE

* Fix silly oversight: actually use PYBIND11_EXPORT_GUARDED_DELETE

* Update struct_smart_holder.h

* style: pre-commit fixes

* Update include/pybind11/detail/struct_smart_holder.h

* Update struct_smart_holder.h

* ci: fix addition to reusable-standard.yml

* Update CMakeLists.txt

* refactor: rename tests to test_cross_module_rtti

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.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: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2025-06-03 16:02:19 -04:00
Henry Schreiner
d4d2ec1ad8 ci: avoid brownout (and removal) of windows-2019 (#5712)
* ci: avoid brownout (and removal) of windows-2019

* Drop 2019 or update to 2022/latest
2025-06-03 13:06:20 -04:00
pre-commit-ci[bot]
0985052ad6 chore(deps): update pre-commit hooks (#5711)
updates:
- [github.com/pre-commit/mirrors-clang-format: v20.1.3 → v20.1.5](https://github.com/pre-commit/mirrors-clang-format/compare/v20.1.3...v20.1.5)
- [github.com/astral-sh/ruff-pre-commit: v0.11.8 → v0.11.12](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.8...v0.11.12)
- [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.16.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.16.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-06-02 18:08:40 -04:00
Henry Schreiner
9295c4a568 fix: follow rest of pybind11 closer with PYBIND11_HAS_SUBINTERPRETER_SUPPORT (#5710)
* fix: follow rest of pybind11 closer with PYBIND11_HAS_SUBINTERPRETER_SUPPORT

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-06-02 16:08:40 -04:00
Henry Schreiner
7da1d53df5 ci: test on iOS (#5705)
* ci: add iOS

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update .github/workflows/tests-cibw.yml

* ci: use test groups

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-02 00:29:40 -04:00
Michael Carlstrom
c2b32b1e3b fix(types): type hints from future python versions (#5693)
* fix future type hints

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* style: pre-commit fixes

* remove unused var

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* remove union_helper

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* fix speelling error

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* base case for union_concat

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* style: pre-commit fixes

* add case for one descr

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* weakref and final test

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* Add acrpss_version_type_hint_checker

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* cleanup

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* style: pre-commit fixes

* remove test.pyi

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* use new unions and add fixture

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* timohl suggested cleanup

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* style: pre-commit fixes

* add missing auto

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>

* style: pre-commit fixes

* move operator| def

---------

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-31 23:47:20 -04:00
Henry Schreiner
21c9dd11bc ci: drop main tests on main
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-31 15:44:42 -04:00
Henry Schreiner
e4873e8f59 fix: allow subinterp support to be disabled
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-31 15:44:42 -04:00
Henry Schreiner
33fb53335e fix: C++20 in Windows
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

style: pre-commit fixes
2025-05-30 18:30:25 -04:00
Henry Schreiner
bc557a9b5b tests: add PYBIND11_TEST_SMART_HOLDER to tests
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-30 18:30:25 -04:00
Henry Schreiner
29979761ba ci: rename cibw workflow file
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-30 18:30:25 -04:00
Henry Schreiner
7e672ca106 tests: support C++23 in tests
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-30 18:30:25 -04:00
Henry Schreiner
ef2ad42d2d ci: list all jobs explicitly
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-30 18:30:25 -04:00
Henry Schreiner
5dff3354fc ci: reduce runs on draft PRs
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

Update ci.yml
2025-05-30 18:30:25 -04:00
Henry Schreiner
df595b1657 docs: changelog update for 3.0.0rc2
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
v3.0.0rc2
2025-05-29 11:05:00 -04:00
Henry Schreiner
a1b1972241 chore: prepare for 3.0.0rc2 (#5698)
* chore: prepare for 3.0.0rc2

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update docs/changelog.md

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-29 01:16:32 -04:00
Henry Schreiner
a18b1bc4dc tests: always disable on the nogil build (#5701)
* docs: fix docs on visibilty preset hidden

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* tests: always disable on the nogil build

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

* docs: mention skip reason in comment

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-28 23:33:53 -04:00
Henry Schreiner
57e27c1ffc tests: skip some flaky gil tests on nogil (#5699)
* tests: skip some flaky gil tests on nogil

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update test_gil_scoped.py

* style: pre-commit fixes

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-27 11:22:35 -04:00
Henry Schreiner
1c10d5e9b1 fix: prepare for 3.14 beta 2 (#5697)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-27 00:05:19 -04:00
Henry Schreiner
6e3e8515e7 fix(cmake): regression in include gaurd (#5691)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-26 12:26:08 -04:00
b-pass
03b4a9e56f fix: don't destruct module objects in atexit (#5688) 2025-05-25 18:56:26 -04:00
Henry Schreiner
1dd85ef42a chore: bump maximum clang tested to 20 (#5692) 2025-05-25 10:54:05 -04:00
Henry Schreiner
9d06626521 docs: more warnings about locking and the GIL (#5689)
* docs: more warnings about locking and the GIL

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix require → reacquire typo

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
2025-05-24 19:12:49 -04:00
Henry Schreiner
d7769de533 feat: scoped_critical_section (#5684)
* feat: scoped_critical_section

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* refactor: pull out to file

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit fixes

* fix: GIL code in some compilers

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: move to correct spot

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-23 17:41:45 -04:00