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
223283295f
Two minor platform-specific fixes. Using static_cast instead of reinterpret_cast.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
993613d9bf
Trying again, to get around unused parameter warnings-as-erros.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
20ef96c87d
Disabling debugging call of weak_from_this
for C++ < 17.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
bf8d6a2900
First fully successful attempt to make shared_from_this
and trampolines play nicely.
...
Now also passes the open_spiel iterated_prisoners_dilemma_test ASAN clean, in addition to all pybind11 and PyCLIF unit tests.
The problem was that calling `std::shared_ptr<void>::reset()` with a `void` pointer cannot possibly update the `shared_from_this` `weak_ptr`.
The solution is to store a `shd_ptr_reset` function pointer in `guarded_deleter` (similar in idea to the stored function pointer for calling `delete`).
This commit still includes all debugging code, i.e. is "dirty". The code will be cleaned up after the GitHub CI is fully successful.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
dcf8d0762f
First attempt to make shared_from_this and trampolines play nicely. Passes all pybind11 and PyCLIF unit tests ASAN clean, but not the open_spiel iterated_prisoners_dilemma_test.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
bc21158082
Fixing git rebase -X theirs
accident.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4ab4f36a92
Fixing silly oversight (discovered while creating PR #3041 ).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
cd5fbc56db
Replacing virtual guarded_operator_call
with non-virtual guarded_delete
.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
1e6cc9dd69
Adding back explicit but default copy constructor, to keep some older compilers happy.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
275aaf977a
Inserting const_cast
for std::get_deleter
return, to keep Ubuntu 20 GCC 6.3.0 happy.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
b04a70b5cc
Fixing oversight (clang-tidy error).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
362e64e1ca
WIP snapshot: replacing std::shared_ptr<bool> flag_ptr
with simple bool armed_flag
.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
459301d9a8
WIP snapshot: std::get_deleter experiment.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
e80a1f0617
WIP snapshot.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
eae174b491
Revert "Experiment: effectively undoing all shared_from_this modifications."
...
This reverts commit d72d54ebb0b7784f5616edc02910dbd9cce0b2a4.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
a6abb7cff1
Revert "Experiment: undoing even more."
...
This reverts commit 59bc2e183e7aef5e45c06aed6965de0ac52d7b06.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
5f92b4ff1c
Revert "Experiment: restoring original smart_holder_type_casters.h from smart_holder branch."
...
This reverts commit 19c5a3613fee71878ba2af0339eed325a5916089.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
2ae3c2ceb7
Experiment: restoring original smart_holder_type_casters.h from smart_holder branch.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
9da1e81590
Experiment: undoing even more.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
715ceb4bf3
Experiment: effectively undoing all shared_from_this modifications.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
05bd93543b
Fully emulating type_caster_base-related behavior: trying shared_from_this also for unowned pointees.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
775873d0b6
Adding from_raw_pointer_take_ownership_or_shared_from_this().
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
2a265860a7
enable_shared_from_this_from_raw_ptr_take_ownership_guard: better static_assert that also triggers for derived classes.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
24c223ad8e
static_assert in from_raw_ptr_take_ownership, to be tested.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
7a74bfede7
Restoring init_holder overload for std::enable_shared_from_this and original tests/test_smart_ptr.py.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
94523e8a02
Experiments: 1. disabling enable_shared_from_this, 2. using smart_holder in test_class_sh_shared_from_this.cpp
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
bcad852f6b
Pure clang-format fixes (minor accident in PR #3039 ).
2021-06-29 16:16:00 -07:00
Jakob Lykke Andersen
7312e624b2
SH, improve error message from shared_ptr cast policy check
2021-06-29 05:57:32 -07:00
Jakob Lykke Andersen
be60fc52a4
Allow move policy in smart holder caster for shared_ptr
2021-06-29 05:57:32 -07:00
Jakob Lykke Andersen
c807807c55
Allow copy policy in smart holder caster for shared_ptr
2021-06-29 05:57:32 -07:00
Ralf W. Grosse-Kunstleve
68b6f8c612
Tracking change in type_caster_base.h on master (PR #3059 ).
2021-06-25 21:57:45 -07:00
Cris Luengo
57a36633c4
fix: enable py::implicitly_convertible<py::none, ...> for py::class_-wrapped types ( #3059 )
...
* Allow casting from None to a custom object, closes #2778
* ci.yml patch from the smart_holder branch for full CI coverage.
2021-06-25 21:57:45 -07:00
Ralf W. Grosse-Kunstleve
898d5b301c
Manually fixing merge conflict.
2021-06-22 12:19:40 -07:00
Aaron Gokaslan
dac74ebdf5
fix(clang-tidy): performance fixes applied in tests and CI ( #3051 )
...
* Initial fixes
* Whoops
* Finish clang-tidy manual fixes
* Add two missing fixes
* Revert
* Update clang-tidy
* Try to fix unreachable code error
* Move nolint comment
* Apply missing fix
* Don't override clang-tidy config
* Does this fix clang-tidy?
* Make all clang-tidy errors visible
* Add comments about NOLINTs and remove a few
* Fix typo
2021-06-22 12:11:54 -04:00
Ralf W. Grosse-Kunstleve
8d1e0b3903
[smart_holder] clang-tidy fixes (related to recent clang-tidy changes on master). ( #3053 )
...
* clang-tidy fixes (related to recent clang-tidy changes on master).
* More clang-tidy fixes.
2021-06-21 12:40:10 -07:00
Ralf W. Grosse-Kunstleve
274b014578
Merge branch 'master' into smart_holder
2021-06-21 07:51:19 -07:00
Aaron Gokaslan
3b30b0a51e
fix(clang-tidy): clang-tidy readability and misc fixes, like adding const ( #3052 )
...
* Enable and apply clang-tidy readability and misc fixes.
* Revert deprecated tester
* add space to tests/test_constants_and_functions.cpp
2021-06-21 10:37:48 -04:00
Ralf W. Grosse-Kunstleve
dca304f29e
Merge branch 'master' into smart_holder
2021-06-19 10:55:20 -07:00
Aaron Gokaslan
af6218ff78
fix(clang-tidy): Apply performance fixes from clang-tidy ( #3046 )
...
* Apply performance fixes from clang-tidy
* 2nd Round of Perf Optimizations
* 3rd round of fixes & handle false-positive
* Apply missing fix and clang-format
* Apply reviewer comment
2021-06-19 10:53:27 -07:00
Aaron Gokaslan
c44b41e7c6
[SmartHolder] fix(clang-tidy): apply clang-tidy performance fixes ( #3048 )
...
* Apply clang-tidy performance fixes
* Fix bug introduced by double insert
* Revert all non-smart-holder changes
2021-06-18 12:43:31 -07:00
Ralf W. Grosse-Kunstleve
840eb84aff
Removing std::get_deleter
const_cast
to retest because the code has changed significantly. ( #3045 )
2021-06-17 13:13:21 -07:00
Ralf W. Grosse-Kunstleve
4f61912646
py::smart_holder
std::shared_ptr
deleter simplification & optimization. (#3041 )
2021-06-16 17:47:22 -07:00
Ralf W. Grosse-Kunstleve
a6b2aadf45
Merge branch 'smart_holder' of https://github.com/pybind/pybind11 into smart_holder
2021-06-08 12:15:34 -07:00
Ralf W. Grosse-Kunstleve
48c7a3a68f
Merge branch 'master' into smart_holder
2021-06-08 12:05:19 -07:00
Jack S. Hale
4c7697dbe9
Add const T to docstring generation. ( #3020 )
...
* Add const T to docstring generation.
* Change order.
* See if existing test triggers for a const type.
* Add tests.
* Fix test.
* Remove experiment.
* Reformat.
* More tests, checks run.
* Adding `test_fmt_desc_` prefix to new test functions.
* Using pytest.mark.parametrize to 1. condense test; 2. exercise all functions even if one fails; 3. be less platform-specific (e.g. C++ float is not necessarily float32).
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2021-06-08 11:56:45 -07:00
Robert Haschke
91f97ca401
smart_holder fixups ( #3012 )
...
* Drop constraints on casting of std::shared_ptr
std::shared_ptrs can be shared across python and C++ by design.
* Correctly report casting error
It is important to return an empty handle.
Simply returning None, would skip the error handling in
simple_collector / unpacking_collector, although a python exception is set.
A function call would then be processed with a (wrong) None argument!
* Return None for nullptr
* Revert "Drop constraints on casting of std::shared_ptr"
This reverts commit 7cf53ae8b4
.
2021-05-28 06:35:50 -07:00
Ralf W. Grosse-Kunstleve
2cfc017e2d
Merge branch 'master' into smart_holder
2021-05-27 11:30:03 -07:00
Yichen
3ac690b88b
Explicitly export exception types. ( #2999 )
...
* Set visibility of exceptions to default.
Co-authored-by: XZiar <czktc2007@gmail.com>
* add test
* update docs
* Skip failed test.
2021-05-27 08:00:18 -07:00
Ralf W. Grosse-Kunstleve
6cca66b276
Merge branch 'master' into smart_holder
2021-05-03 22:15:44 -07:00