Ralf W. Grosse-Kunstleve
88cc350075
Merge branch 'master' into smart_holder
2021-07-13 05:57:50 -07:00
Henry Schreiner
0e2e003508
style: add pyupgrade check, 2.7+
2021-07-12 21:46:24 -04:00
Henry Schreiner
84fdadfbcc
chore: update pre-commit hooks
2021-07-12 21:46:24 -04:00
Ralf W. Grosse-Kunstleve
678538f097
Merge branch 'master' into smart_holder
2021-07-12 16:59:58 -07:00
Ralf W. Grosse-Kunstleve
75090647ce
More precise return_value_policy::automatic documentation. ( #2920 )
...
* Adding test_return_vector_bool_raw_ptr to test_stl.py.
* First attempt to make the documentation more accurate, but not trying to be comprehensive, to not bloat the reference table with too many details.
* Fixing minor oversights.
* Applying reviewer suggestion.
2021-07-12 16:56:10 -07:00
Ralf W. Grosse-Kunstleve
932a4cf409
Merge branch 'master' into smart_holder
2021-07-12 14:07:26 -07:00
Ralf W. Grosse-Kunstleve
7472d37a93
Adding iostream.h thread-safety documentation. ( #2995 )
...
* Adding iostream.h thread-safety documentation.
* Restoring `TestThread` code with added `std::lock_guard<std::mutex>`.
* Updating new comments to reflect new information.
* Fixing up `git rebase -X theirs` accidents.
2021-07-12 13:39:06 -07:00
Ralf W. Grosse-Kunstleve
2d468697d9
NOLINT reduction ( #3096 )
...
* Copying from prework_no_rst branch (PR #3087 ): test_numpy_array.cpp, test_stl.cpp
* Manual changes reducing NOLINTs.
* clang-format-diff.py
* Minor adjustment to avoid MSVC warning C4702: unreachable code
2021-07-12 13:10:28 -07:00
Ralf W. Grosse-Kunstleve
14fc79f18e
WIP: restoring valgrind CI on smart_holder branch ( #3090 )
...
* * Rollback of PR #3068 .
* Using latest pytest main branch for 3.9 and 3.10.
* WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 in test_class_sh_trampoline_shared_from_this.py
First experiment combining two potential fixes: latest pytest, workaround.
If this succeeds the next step will be to try only latest pytest without the workaround.
Note: the workaround is known to resolve the MSAN error reported under
https://github.com/pybind/pybind11/pull/3068#issuecomment-877658470
* WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 = False
* Narrowing down WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 to Python 3.9
2021-07-10 17:54:23 -07:00
Ralf W. Grosse-Kunstleve
3c185332b1
Merge branch 'master' into smart_holder
2021-07-09 18:25:32 -07:00
Ralf W. Grosse-Kunstleve
bac5a0c370
Go all the way fixing clang-tidy issues to avoid the NOLINTNEXTLINE clutter and clang-format issues. This was really meant to be part of PR #3051 but was held back either out of an abundance of caution, or because of confusion caused by stray semicolons. ( #3086 )
2021-07-09 14:09:56 -07:00
Ralf W. Grosse-Kunstleve
e7d146bdbd
Merge branch 'master' into smart_holder
2021-07-09 06:47:46 -07:00
Aaron Gokaslan
b5357d1fa8
fix(clang-tidy): Enable clang-tidy else-after-return and redundant void checks ( #3080 )
...
* Enable clang-tidy else-after-return and redundant void checks
* Fix remaining else-after
* Address reviewer comments
* Fix indentation
* Rerun clang-tidy post merge
2021-07-09 06:45:53 -07:00
Ralf W. Grosse-Kunstleve
c03061fcff
Merge branch 'master' into smart_holder
2021-07-08 09:48:42 -07:00
Ralf W. Grosse-Kunstleve
6d1b197b46
Splitting out pybind11/stl/filesystem.h. ( #3077 )
...
* Splitting out pybind11/stl/filesystem.h.
To solve breakages like: https://github.com/deepmind/open_spiel/runs/2999582108
Mostly following the suggestion here: https://github.com/pybind/pybind11/pull/2730#issuecomment-750507575
Except using pybind11/stl/filesystem.h instead of pybind11/stlfs.h, as decided via chat.
stl.h restored to the exact state before merging PR #2730 via:
```
git checkout 733f8de24f
stl.h
```
* Properly including new stl subdirectory in pip wheel config.
This now passes interactively:
```
pytest tests/extra_python_package/
```
* iwyu cleanup.
iwyuh.py -c -std=c++17 -DPYBIND11_TEST_BOOST -Ipybind11/include -I/usr/include/python3.9 -I/usr/include/eigen3 include/pybind11/stl/filesystem.h
* Adding PYBIND11_HAS_FILESYSTEM_IS_OPTIONAL.
* Eliminating else after return.
2021-07-08 09:02:48 -07:00
Robert Haschke
c090c8c409
Unify cast_error message thrown by [simple|unpacking]_collector ( #3013 )
...
* Unify cast_error message thrown by [simple|unpacking]_collector
simple_collector and unpacking_collector throw different error messages
when the casting of an argument failed: While the former mentions make_tuple(),
the latter emphasises the call argument (and its name/position).
* Consolidating "Unable to convert call argument" error reporting code to guarantee uniformity.
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2021-07-06 15:13:13 -07:00
Ralf W. Grosse-Kunstleve
00b0365ca3
codespell fixes and adding .codespell-ignorelines
2021-07-06 14:31:18 -07:00
Ralf W. Grosse-Kunstleve
704daac879
Merge branch 'master' into smart_holder
2021-07-06 14:12:08 -07:00
luzpaz
8bee61b645
docs: fix various typos ( #3075 )
...
Found via `codespell -q 3 -L nd,ot,thist`
2021-07-04 19:58:35 -04:00
Ralf W. Grosse-Kunstleve
52c3f4cc30
This was meant to be PR #3065 : pure clang-format changes. NO manual changes. ( #3073 )
2021-07-02 16:51:24 -07:00
Ralf W. Grosse-Kunstleve
84cbec0bc1
Merge branch 'master' into smart_holder
2021-07-02 07:07:49 -07:00
Antony Lee
5bcaaa0423
Add a std::filesystem::path <-> os.PathLike caster. ( #2730 )
2021-07-02 07:00:50 -07:00
Ralf W. Grosse-Kunstleve
cad79c1146
tests: remove very minor oversight in PR #3059 . ( #3066 )
2021-06-30 17:30:26 -04:00
Ralf W. Grosse-Kunstleve
94f0db58ee
Fixing merge accident related to merging PR #3059 from master.
...
I did not go back to check when and why exactly this slipped in.
Also removing unused `msg` (oversight in PR #3059 ).
2021-06-30 13:30:34 -07:00
Ralf W. Grosse-Kunstleve
c2111fd353
Merge branch 'master' into smart_holder
2021-06-30 12:36:27 -07:00
Ralf W. Grosse-Kunstleve
fbae8f313b
pickle setstate: setattr __dict__ only if not empty ( #2972 )
...
* pickle setstate: setattr __dict__ only if not empty, to not force use of py::dynamic_attr() unnecessarily.
* Adding unit test.
* Clang 3.6 & 3.7 compatibility.
* PyPy compatibility.
* Minor iwyu fix, additional comment.
* Addressing reviewer requests.
* Applying clang-tidy suggested fixes.
* Adding check_dynamic_cast_SimpleCppDerived, related to issue #3062 .
2021-06-30 12:34:32 -07:00
Ralf W. Grosse-Kunstleve
5af253d66c
Adding test_multiple_registered_instances_for_same_pointee_recursive.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
a021e045a9
Adding test_multiple_registered_instances_for_same_pointee_leak. Subtle changes in smart_holder_type_caster_load, trying to work on weak_ptr for shared_ptr_trampoline_self_life_support, but that didn't work out. Manually fully leak-checked again.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
595f7f4f6e
Fixing git rebase -X theirs smart_holder
issue.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
e2108546e1
Adding unit tests: 2 x test_std_make_shared_factory
...
Completes unit test coverage for the changed code in smart_holder_type_casters.h.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
1b752f56c1
Adding unit test: test_multiple_registered_instances_for_same_pointee
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
64716cc14c
Adding a few comments after review by @laramiel.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4a08160a1f
Revert "Updating Catch version to latest, in hopes of resolving the GHA download issue affecting all MSVC builds."
...
This reverts commit f4e1112dc434d0505cecad6259113f0621ecba70.
It didn't help.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
db6244864f
Updating Catch version to latest, in hopes of resolving the GHA download issue affecting all MSVC builds.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
ab3c5134ad
Cleaning out debug code.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
ef89a43452
Removing experimental code from here. Will be moved to https://github.com/rwgk/rwgk_tbx .
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
146a925e4e
Resolving TODOs for from_unique_ptr
void_cast_raw_ptr
. Adding test to exercise the path through cast
. The path through init.h is missing a test that would fail if the flag is incorrect. The plan is to systematically cover all situations (there are many that are not exercised for shared_from_this).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
a0e19bdc46
Use casting to void *
to evade to shared_from_this mechanism only if pointee_depends_on_holder_owner
, but currently only for from_raw_ptr_take_ownership
.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
ccd16a1a14
Adding test_pure_cpp_sft_raw_ptr (with 3 TODO: Fix), test_pure_cpp_sft_shd_ptr (works as desired).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4a15ed742c
Adding // NOLINT for clang-tidy.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
10abe15052
Automatic clang-tidy fixes.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
48eb78ae77
Simpler and safe implementation based on new requirement: C++ (outside of the Python object) needs to hold a shared_ptr before shared_from_this is called. This is more similar to the existing implementation on current smart_holder HEAD, but still uses a weak_ptr to always return the same shared_ptr as long as C++ does not let it expire.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
3dd89f14df
smart_holder_poc.h: type-erase raw_ptr before passing to shared_ptr::reset, to not trigger populating the shared_from_this weak_ptr. This way the only way the weak_ptr is populated is through loaded_as_shared_ptr. Breaks all but one test in test_class_sh_trampoline_shared_from_this.py, now marked skip WIP to test everything else with the GitHub CI.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
b1d9f0d28f
Applying clang-tidy suggested fixes.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
adfd3e1700
Partial cleanup of tests. WIP. The cleanup uncovered a major problem.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
bfd4c4893e
Leveraging new noop_deleter_acting_as_weak_ptr_owner
to retrieve released vptr
.
...
The placeholder `vptr` is never exposed anymore, therefore the externally visible `use_count`s are more intuitive.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
0e4b38e34d
Minor clang-tidy fix.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4b872febcc
Adding test_pass_released_shared_ptr_as_unique_ptr
, exercising new guard in smart_holder_type_casters.h.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
e04196e82b
Attempts to side-step various platform-specific issues.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
6214137c8d
Resolving gcc warning-as-error (many versions, old and new).
2021-06-30 07:04:31 -07:00