Commit Graph

2937 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
3466ce5f63 Add pytest.skip("BAKEIN_BREAK: ...") in test_class_sh_mi_thunks.py 2024-07-05 15:20:07 -07:00
Ralf W. Grosse-Kunstleve
25c8edf994 Bring in tests/test_class_sh_mi_thunks.cpp,py from smart_holder branch as-is (Segmentation fault). 2024-07-05 14:47:39 -07:00
Ralf W. Grosse-Kunstleve
288442cd5c Add more test_class_sh_* in tests/CMakeLists.txt
All unit tests pass ASAN and MSAN testing with the Google-internal toolchain.
2024-07-05 14:40:43 -07:00
Ralf W. Grosse-Kunstleve
fcc868df59 Add PYBIND11_TYPE_CASTER_BASE_HOLDER(...) (no-op) 2024-07-05 14:37:15 -07:00
Ralf W. Grosse-Kunstleve
4ce1524c61 Bring in tests/test_class_sh_shared_ptr_copy_move.cpp,py from smart_holder branch as-is (does not build). 2024-07-05 14:25:44 -07:00
Ralf W. Grosse-Kunstleve
d9d96118e6 Bring in all tests/test_class_*.cpp,py from smart_holder branch as-is that pass without any further changes.
All unit tests pass ASAN and MSAN testing with the Google-internal toolchain.
2024-07-05 12:56:41 -07:00
Ralf W. Grosse-Kunstleve
470a765804 Bring in tests/test_class_sh_factory_constructors.cpp,py from smart_holder branch as-is (tests pass without any further changes).
All unit tests pass ASAN and MSAN testing with the Google-internal toolchain.
2024-07-05 12:38:07 -07:00
Ralf W. Grosse-Kunstleve
46ab14ebb4 Add missing explicit to resolve clang-tidy error. 2024-07-05 12:33:19 -07:00
Ralf W. Grosse-Kunstleve
c84dacc379 Factor out smart_holder_value_and_holder_support.h to avoid code duplication.
All unit tests pass ASAN and MSAN testing with the Google-internal toolchain.
2024-07-05 12:18:11 -07:00
Ralf W. Grosse-Kunstleve
e593589c61 inline unique_ptr_to_python() in cast.h 2024-07-05 10:12:21 -07:00
Ralf W. Grosse-Kunstleve
12c0eb3889 inline shared_ptr_to_python() in cast.h 2024-07-05 10:05:29 -07:00
Ralf W. Grosse-Kunstleve
0b7a628a04 Check for Python instance is uninitialized/disowned in type_caster_base.h. CRUDE intermediate state, needs refactoring.
All 4 remaining BAKEIN_BREAK removed from test_class_sh_basic.py. With that both test_class_sh_basic.cpp and test_class_sh_basic.py are identical to the smart_holder branch.

All unit tests pass ASAN and MSAN testing with the Google-internal toolchain.
2024-07-05 00:28:43 -07:00
Ralf W. Grosse-Kunstleve
fd1afdb2b9 move_only_holder_caster<...unique_ptr...>::load_value(): throw instead of return false (i.e. prefer noisy failure over potentially silent failure). 2024-07-04 23:57:34 -07:00
Ralf W. Grosse-Kunstleve
66fb5c942c
Merge branch 'master' into bakein 2024-07-04 18:21:55 -07:00
Ralf W. Grosse-Kunstleve
874f69d898 Add cast(const std::unique_ptr<type, deleter> &, ...). Remove the last 3 remaining BAKEIN_BREAK in test_class_sh_basic.cpp 2024-07-04 16:09:01 -07:00
Ralf W. Grosse-Kunstleve
ebbe066841 Implement operator std::unique_ptr<type, deleter>(). Resolves all but 1 block of 4 BAKEIN_BREAK in test_class_sh_basic.py 2024-07-04 11:26:43 -07:00
Ralf W. Grosse-Kunstleve
0eb23f2ad1 Remove all but 3 BAKEIN_BREAK in test_class_sh_basic.cpp 2024-07-04 08:47:34 -07:00
Ralf W. Grosse-Kunstleve
391d7726ad Remove operator type *() unique_ptr, and & (not sure how they would be useful). 2024-07-04 08:25:06 -07:00
Ralf W. Grosse-Kunstleve
d4fc392ebe move_only_holder_caster<type, std::unique_ptr<T, D>>: inherit from type_caster_base<T>
CRUDE INTERMEDIATE STATE, just to see if this builds on all platforms.
2024-07-03 15:16:46 -07:00
Ralf W. Grosse-Kunstleve
224e9343d2 Implement operator std::shared_ptr<type> &(), remove 2 BAKEIN_BREAK: pass_shmp, pass_shcp 2024-07-03 13:51:50 -07:00
Ralf W. Grosse-Kunstleve
af66246fb6 Resolve clang-tidy errors:
```
/__w/pybind11/pybind11/include/pybind11/cast.h:918:44: error: std::move of the variable 'v_h' of the trivially-copyable type 'pybind11::detail::value_and_holder' has no effect [performance-move-const-arg,-warnings-as-errors]
            return load_value_smart_holder(std::move(v_h));
                                           ^
/__w/pybind11/pybind11/include/pybind11/cast.h:911:53: note: consider changing the 1st parameter of 'load_value_smart_holder' from 'pybind11::detail::value_and_holder &&' to 'const pybind11::detail::value_and_holder &'
    bool load_value_smart_holder(value_and_holder &&v_h) {
                                                    ^
/__w/pybind11/pybind11/include/pybind11/cast.h:920:38: error: std::move of the variable 'v_h' of the trivially-copyable type 'pybind11::detail::value_and_holder' has no effect [performance-move-const-arg,-warnings-as-errors]
        return load_value_shared_ptr(std::move(v_h));
                                     ^
/__w/pybind11/pybind11/include/pybind11/cast.h:895:51: note: consider changing the 1st parameter of 'load_value_shared_ptr' from 'pybind11::detail::value_and_holder &&' to 'const pybind11::detail::value_and_holder &'
    bool load_value_shared_ptr(value_and_holder &&v_h) {
                                                  ^
```
2024-07-03 12:54:41 -07:00
Ralf W. Grosse-Kunstleve
fc5678b08b Add value_and_holder loaded_v_h; member (set, but currently unused). 2024-07-03 11:26:04 -07:00
Ralf W. Grosse-Kunstleve
2837df178e Rename holder to shared_ptr_holder to improve readability. No functional changes. 2024-07-03 10:49:17 -07:00
Ralf W. Grosse-Kunstleve
17c0354050 copyable_holder_caster<type, std::shared_ptr<type>>: split load_value_shared_ptr(), load_value_smart_holder() (the latter just throws right now) 2024-07-03 10:30:14 -07:00
Ralf W. Grosse-Kunstleve
556f28a1a4 Add smart_holder_from_shared_ptr() specialization for std::shared_ptr<T const>
Resolves one `// BAKEIN_WIP: Better Const2Mutbl`.
2024-07-03 07:41:48 -07:00
Ralf W. Grosse-Kunstleve
5957133b6e Add smart_holder_from_unique_ptr() specialization for std::unique_ptr<T const, D>
Enables removing:
4 BAKEIN_BREAK in test_class_sh_basic.cpp
2 BAKEIN_BREAK in test_class_sh_basic.py
2024-07-03 07:38:18 -07:00
Ralf W. Grosse-Kunstleve
7a6d30ca58 Fix rtrn_shmp, rtrn_shmp by transferring smart_holder_from_shared_ptr() functionality from smart_holder branch. 2024-07-02 18:25:01 -07:00
Ralf W. Grosse-Kunstleve
a332fe8cf4 Fix oversights: Add pybind11/smart_holder.h in CMakeLists.txt, tests/extra_python_package/test_files.py 2024-07-02 15:15:19 -07:00
Ralf W. Grosse-Kunstleve
12b01305de Add no-op pybind11/smart_holder.h, 21 BAKEIN_BREAK in test_class_sh_basic.cpp, 26 BAKEIN_BREAK in test_class_sh_basic.py
```
========================================================= short test summary info ==========================================================
SKIPPED [1] test_class_sh_basic.py:59: got empty parameter set ('pass_f', 'rtrn_f', 'expected'), function test_load_with_rtrn_f at /usr/local/google/home/rwgk/forked/pybind11/tests/test_class_sh_basic.py:58
SKIPPED [1] test_class_sh_basic.py:70: got empty parameter set ('pass_f', 'rtrn_f', 'regex_expected'), function test_deleter_roundtrip at /usr/local/google/home/rwgk/forked/pybind11/tests/test_class_sh_basic.py:69
SKIPPED [1] test_class_sh_basic.py:99: got empty parameter set ('pass_f', 'rtrn_f', 'expected'), function test_pass_unique_ptr_disowns at /usr/local/google/home/rwgk/forked/pybind11/tests/test_class_sh_basic.py:98
SKIPPED [1] test_class_sh_basic.py:120: got empty parameter set ('pass_f', 'rtrn_f'), function test_cannot_disown_use_count_ne_1 at /usr/local/google/home/rwgk/forked/pybind11/tests/test_class_sh_basic.py:119
SKIPPED [1] test_class_sh_basic.py:145: BAKEIN_BREAK: AttributeError unique_ptr_roundtrip
SKIPPED [1] test_class_sh_basic.py:157: unconditional skip
SKIPPED [1] test_class_sh_basic.py:169: got empty parameter set ('pass_f', 'rtrn_f', 'moved_out', 'moved_in'), function test_unique_ptr_consumer_roundtrip at /usr/local/google/home/rwgk/forked/pybind11/tests/test_class_sh_basic.py:168
SKIPPED [1] test_class_sh_basic.py:210: BAKEIN_BREAK: AttributeError args_unique_ptr
====================================================== 17 passed, 8 skipped in 0.04s =======================================================```
2024-07-02 14:43:23 -07:00
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