Commit Graph

2958 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
b6171bc7ad Bring in tests/test_class_sh_basic.cpp,py from smart_holder branch as-is (does not build). 2024-07-02 13:40:16 -07:00
Ralf W. Grosse-Kunstleve
66a775eee9 Replace BAKEIN_BREAK with BAKEIN_EXPECTED in test_smart_ptr_from_default(). 2024-07-02 11:24:40 -07:00
Ralf W. Grosse-Kunstleve
f84be2e15a Remove all BAKEIN_BREAK in test_pickling.cpp,py (tests pass without any production code changes). 2024-07-02 11:03:26 -07:00
Ralf W. Grosse-Kunstleve
c92b4d86da Insert PYBIND11_SMART_HOLDER_PADDING (with the idea to catch undefined behavior sooner rather than later). 2024-07-02 10:57:25 -07:00
Ralf W. Grosse-Kunstleve
9e3cdf7f72 Update .codespell-ignore-lines for tests/pure_cpp/smart_holder_poc_test.cpp 2024-07-02 10:45:33 -07:00
Ralf W. Grosse-Kunstleve
107bcf9cb4 Bring in tests/pure_cpp/smart_holder_poc_test.cpp from smart_holder branch as-is. 2024-07-02 10:20:51 -07:00
Sam Gross
bb05e0810b
Use PyMutex instead of std::mutex in free-threaded build. (#5219)
* 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>
2024-07-02 09:58:09 -07:00
pre-commit-ci[bot]
b21b049029
chore(deps): update pre-commit hooks (#5220)
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>
2024-07-01 23:03:52 -07:00
Ralf W. Grosse-Kunstleve
6b89ca002e test_class.cpp: transfer CHECK_SMART_HOLDER from smart_holder branch (replaces BAKEIN_BREAK). 2024-07-01 22:57:33 -07:00
Ralf W. Grosse-Kunstleve
6c227c7a90 Remove pytest.skip("BAKEIN_BREAK: ...") in test_class.py (not needed anymore). 2024-07-01 22:52:30 -07:00
Ralf W. Grosse-Kunstleve
b0cfeec63c Merge branch 'master' into bakein 2024-07-01 21:51:36 -07:00
Ralf W. Grosse-Kunstleve
7de474f956 Add new include files to CMakeLists.txt, tests/extra_python_package/test_files.py 2024-07-01 18:09:19 -07:00
Ralf W. Grosse-Kunstleve
8254d77d70 Add pytest.skip("BAKEIN_BREAK: ...") in test_smart_ptr.py (all non-skipped tests pass locally with C++17). 2024-07-01 15:59:59 -07:00
Ralf W. Grosse-Kunstleve
ae08f51e38 Start pybind11/detail/smart_holder_type_caster_support.h, move unique_ptr_to_python() there, add smart_holder_from_unique_ptr() 2024-07-01 15:52:50 -07:00
Ralf W. Grosse-Kunstleve
6ff547e18a Introduce type_caster_base<>::unique_ptr_to_python() 2024-07-01 12:39:45 -07:00
Ralf W. Grosse-Kunstleve
5518e01562 Copy-paste-and-specialize copyable_holder_caster<shared_ptr>, move_only_holder_caster<unique_ptr>. No functional changes. 2024-07-01 11:47:34 -07:00
Ralf W. Grosse-Kunstleve
e4d0a55575 Remove is_holder_type<unique_ptr> 2024-07-01 11:18:56 -07:00
dependabot[bot]
d78446cc2b
chore(deps): bump actions/attest-build-provenance in the actions group (#5216)
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.1.2 to 1.3.2
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](173725a120...bdd51370e0)

---
updated-dependencies:
- 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>
2024-06-30 23:32:03 -04:00
Ralf W. Grosse-Kunstleve
c6a917eeae Add make_some_type() to test_wip (reproduces Segmentation fault in test_class). 2024-06-30 14:09:19 -07:00
Ralf W. Grosse-Kunstleve
8fe75ff85b Remove all (3) BAKEIN_BREAK from test_factory_constructors.cpp and all (4) BAKEIN_BREAK from test_factory_constructors.py (test_factory_constructors builds and runs successfully). 2024-06-30 11:41:03 -07:00
Ralf W. Grosse-Kunstleve
381fdc54e9 Bring in smart_holder_from_unique_ptr(), smart_holder_from_shared_ptr() from smart_holder_type_casters.h (with this test_wip builds and runs successfully). 2024-06-30 11:32:10 -07:00
Ralf W. Grosse-Kunstleve
e8cd42953e pybind11/detail/init.h: replace type_uses_smart_holder_type_caster<> with is_same<Holder<Class>, smart_holder> (still does not build). 2024-06-30 11:22:41 -07:00
Ralf W. Grosse-Kunstleve
03e6a93c73 Remove stray line (probably from an accident/oversight a long time ago; harmless). 2024-06-30 10:03:58 -07:00
Ralf W. Grosse-Kunstleve
dfaa49bb21 Bring in pybind11/detail/class.h, init.h as-is from smart_holder branch (does not build). 2024-06-30 10:00:33 -07:00
Michael Carlstrom
d805e9967f
feat(types) Adds special Case for empty C++ tuple type annotation (#5214)
* add special case and unit test

* add newline
2024-06-30 09:52:37 -07:00
Ralf W. Grosse-Kunstleve
33b0b387f1 Minimal reproducer for one of the test_factory_constructors.cpp build errors. 2024-06-29 16:13:47 -07:00
Ralf W. Grosse-Kunstleve
bcc3b87b8d Comment out or skip: with this test_factory_constructors passes.
skip-checks: true
2024-06-29 15:10:42 -07:00
Ralf W. Grosse-Kunstleve
a1e312e13c Comment out or skip: with this test_pickling passes. 2024-06-29 14:43:01 -07:00
Ralf W. Grosse-Kunstleve
9a88c09a31 Comment out or skip: with this test_class passes. 2024-06-29 14:39:08 -07:00
Ralf W. Grosse-Kunstleve
144ae8be51 Also bring in try_initialization_using_shared_from_this() from smart_holder_type_casters.h. With this test_wip builds and succeeds. 2024-06-29 14:00:34 -07:00
Ralf W. Grosse-Kunstleve
fbf88cb298 Bring smart_holder init_instance_for_type<> directly into the init_instance() specialization. Also bring in dynamic_raw_ptr_cast_if_possible.h. Does not build because try_initialization_using_shared_from_this() is still missing. 2024-06-29 13:53:50 -07:00
Ralf W. Grosse-Kunstleve
00a91571fb fix build failure by introducing init_instance() specialization for smart_holder (test fails) 2024-06-29 12:13:19 -07:00
Ralf W. Grosse-Kunstleve
97a3a49678 make smart_holder the default holder (baby step; does not build) 2024-06-29 12:07:28 -07:00
Ralf W. Grosse-Kunstleve
e5907480f5 Add py::class_<SomeType> with default ctor. 2024-06-29 11:09:03 -07:00
Ralf W. Grosse-Kunstleve
ced85c95b1 Add tests/test_wip.cpp,py (empty) 2024-06-29 11:04:19 -07:00
Ralf W. Grosse-Kunstleve
8b0b377fc1 Bring in smart_holder_poc.h from smart_holder branch (baby step). 2024-06-28 23:02:14 -07:00
wenqing
51c2aa16de
Fixed a compilation error with gcc 14 (#5208) 2024-06-28 07:12:32 -07:00
Michael Carlstrom
08f946a431
fix: add guard for GCC <10.3 on C++20 (#5205)
* Update CI

* update define guard

* style: pre-commit fixes

* updated define guard

* style: pre-commit fixes

* update guard

* testing new guards

* update guards

* surely this time

* style: pre-commit fixes

* Define PYBIND11_TYPING_H_HAS_STRING_LITERAL to avoid repeating a complex expression.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2024-06-27 22:20:28 -07:00
Varun Agrawal
e0f9e77466
fix(cmake): remove extra = in flto assignment (#5207) 2024-06-27 22:26:09 -04:00
Henry Schreiner
57287b578d
docs: prepare for 2.13.1 (#5203)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-06-26 18:14:17 -04:00
Michael Carlstrom
4bd538a40a
feat(types): add support for Typing.Callable Special Case (#5202)
* Add special case

* linty
2024-06-26 16:34:06 -04:00
Sam Gross
2e35470cff
fix: use manual padding of instance_map_shard (#5200)
* Use manual padding of instance_map_shard.

The alignas(64) specifier requires aligned allocation, which is not
available on macOS when targeting versions before 10.14.

* Add 'see #5200'

* Update include/pybind11/detail/internals.h

* Update include/pybind11/detail/internals.h

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2024-06-26 15:46:46 -04:00
Henry Schreiner
895e657220
chore: back to work
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-06-26 00:42:54 -04:00
Henry Schreiner
0c69e1eb21
chore: prepare for 2.13.0 (#5198)
* chore: prepare for 2.13.0

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

* Update changelog.rst

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-06-25 23:51:27 -04:00
Michael Carlstrom
2be85c6041
feat(types): adds support for TypeGuard and TypeIs (#5194)
* Adds support for TypeGuard and TypeIs

* style: pre-commit fixes

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-25 22:53:15 -04:00
Henry Schreiner
b5ec7c7174
ci: release with trusted publisher and attestations (#5196)
* ci: release with trusted publisher and attestations

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

* Update pip.yml

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-06-25 21:12:58 -04:00
Michael Carlstrom
26281c7986
feat(types): adds support for Never and NoReturn from python Typing (#5193)
* Adds support for Never and NoReturn

* lint
2024-06-25 21:10:25 -04:00
Michael Carlstrom
183059f9a4
feat(types): add support for typing.Literal type (#5192)
* typevar prototype

* style: pre-commit fixes

* change to NameT

* style: pre-commit fixes

* make string const

* add missing closing bracket

* style: pre-commit fixes

* clean up handle_type_name

* style: pre-commit fixes

* add back missing <

* style: pre-commit fixes

* add back NameT

* try fixed_string

* style: pre-commit fixes

* std::basic_fixed_string

* test c++20

* style: pre-commit fixes

* cleanup

* fix object to typevar conversion

* style: pre-commit fixes

* And CPP20 checks

* style: pre-commit fixes

* add missing cpp20++ check

* style: pre-commit fixes

* Add C++20 check to python

* Fix python if {

* style: pre-commit fixes

* update test name

* style: pre-commit fixes

* remove call on cpp_std

* make field const

* test nontype_template

* update feature check

* update name of guard

* fix try except in test

* fix pre commit

* remove extra semi colon

* except AttributeError

* fix try except in test

* remove const

* Clean up tests

* style: pre-commit fixes

* start string literal

* start int literal

* func declare

* commit clean

* use contextlib.suppres

* resolve stash

* more literal type

* fix annotation name

* stash

* request changes

* lint

* Add comments

* style: pre-commit fixes

* Add support for unions and optionals to be compatible with object

* lint

* remove comment

* Create Literal Type implementation

* clean up

* Update comment

* remove incorrect comment

* rerun CI

* rerun CI

* fix extra line

* lint

* move if defined block

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-25 17:57:34 -04:00
Michael Carlstrom
aebcd704d2
Add TypeVars / method generics typing (#5167)
* typevar prototype

* style: pre-commit fixes

* change to NameT

* style: pre-commit fixes

* make string const

* add missing closing bracket

* style: pre-commit fixes

* clean up handle_type_name

* style: pre-commit fixes

* add back missing <

* style: pre-commit fixes

* add back NameT

* try fixed_string

* style: pre-commit fixes

* std::basic_fixed_string

* test c++20

* style: pre-commit fixes

* cleanup

* fix object to typevar conversion

* style: pre-commit fixes

* And CPP20 checks

* style: pre-commit fixes

* add missing cpp20++ check

* style: pre-commit fixes

* Add C++20 check to python

* Fix python if {

* style: pre-commit fixes

* update test name

* style: pre-commit fixes

* remove call on cpp_std

* make field const

* test nontype_template

* update feature check

* update name of guard

* fix try except in test

* fix pre commit

* remove extra semi colon

* except AttributeError

* fix try except in test

* remove const

* Clean up tests

* style: pre-commit fixes

* use contextlib.suppres

* request changes

* lint

* Add comments

* style: pre-commit fixes

* Add support for unions and optionals to be compatible with object

* lint

* remove comment

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-25 16:25:40 -04:00
Henry Schreiner
9ec64e37c3
docs: prepare for 2.13.0 (#5187)
* docs: prepare for 2.13.0

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

* docs: reword cross-compiling entry

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

* Update changelog.rst

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-06-25 16:24:54 -04:00