Ralf W. Grosse-Kunstleve
f4c27c34e8
Using type_caster_base<mpty>::src_and_type directly, removing copy. Also renaming one cast to cast_const_raw_ptr, for clarity.
2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
45df6826e6
Cosmetical change around helper functions.
2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
86ba2081af
Removing enable_shared_from_this stub, simplifying existing code, clang-format.
...
Open question, with respect to the original code:
76a160070b/include/pybind11/pybind11.h (L1510)
To me it looks like the exact situation marked as `std::shared_ptr<Good> gp1 = not_so_good.getptr();` here: https://en.cppreference.com/w/cpp/memory/enable_shared_from_this
The comment there is: `// undefined behavior (until C++17) and std::bad_weak_ptr thrown (since C++17)`
Does the existing code have UB pre C++17?
I'll leave handling of enable_shared_from_this for later, as the need arises.
2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
b41a0db1b1
Calling deregister_instance after disowning via unique_ptr.
2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
b85cc69714
Making test_type_caster_bare_interface_demo.cpp slightly more realistic, ASAN, MSAN, UBSAN clean.
2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
e4d6d860b6
Fixing bugs discovered by ASAN. The code is now ASAN, MSAN, UBSAN clean.
2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
3bc50c57b4
Bug fix: vptr_deleter_armed_flag_ptr has to live on the heap.
...
See new bullet point in comment section near the top.
The variable was also renamed to reflect its function more accurately.
2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
4ddd65de00
static handle cast implementations for rtrn_uqmp, rtrn_uqcp.
2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
68bee938de
Adding MISSING comments in operator std::unique_ptr<mpty[ const]>.
2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
6601ec4ea7
static handle cast implementations for rtrn_shmp, rtrn_shcp.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
649eb91f21
Adding comment re potential use_count data race.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
6294eb26e5
Pure clang-format change (applied to original type_caster_generic::cast).
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
ee6d15647d
Copying type_caster_generic::cast into type_caster<mpty> as-is (preparation for handling smart pointers).
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
4359422d99
static cast handle for rtrn_valu works by simply dropping in code from type_caster_base (marked with comments). rtrn_rref raises a RuntimeError, to be investigated.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
6dea65fe64
static cast handle for rtrn_cref works by simply dropping in code from type_caster_base (marked with comments). rtrn_mref and rtrn_mptr work via const_cast (to add const).
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
e70a882718
static cast handle for rtrn_cptr works by simply dropping in code from type_caster_base (marked with comments).
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
d88be00a7a
Systematically setting mtxt for all rtrn_mpty_* functions (preparation, the values are not actually used yet).
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
db529c805c
flake8 cleanup
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
d3833d2cbf
Fixing oversight (discovered by flake8).
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
ec8ebb766a
Pure clang-format --style=file -i
change, with two clang-format off
directives.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
e7aea026bb
Pure clang-format --style=file -i
change.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
cfc848a137
Retrieving smart_holder pointer in type_caster<std::unique_ptr<mpty[ const]>>::load, and using it cast_op operators.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
6277910abd
Improved error messaging: Cannot disown nullptr (as_unique_ptr).
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
4a879cfdcb
Retrieving smart_holder pointer in type_caster<std::shared_ptr<mpty[ const]>>::load, and using it cast_op operators.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
3f7a1a1b30
Factoring out smart_holder_type_caster_load.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
4b35955a12
Retrieving smart_holder pointer in type_caster<mpty>::load, and using it cast_op operators.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
fe5427fc23
Adding rvalue_ref, renaming const_value_ref to lvalue_ref & removing const.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
6bdd58a115
Adding isinstance<mpty> in type_caster::load functions.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
1ce4256921
Adding mpty::mtxt string member.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
c8d19f9599
Hard-coding smart_holder into classh.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
03f304e419
classh.h: renaming of class_ to classh + namespace; forking test_classh_wip from test_type_caster_bare_interface_demo.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
a5818bdf4a
Pure copy of class class_
implementation in pybind11.h (master commit 98f1bbb800
).
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
b3ad3ac43f
Adding unique_ptr<mpty>, unique_ptr<mpty const> casters.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
d36a7488ae
Adding shared_ptr<mpty>, shared_ptr<mpty const> casters.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
de10541b12
Adding type_caster_bare_interface_demo.
2021-02-09 06:47:05 -08:00
Ralf W. Grosse-Kunstleve
2cb68ab051
Removing stray file.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
69270b5dde
Removing obsolete and very incomplete test (replaced by Catch2-based test).
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
9abea63276
Converting from methods to factory functions (no functional change).
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
a23e179fee
Adding top-level comment.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
01cacaf207
Testing of exceptions not covered by the from-as matrix.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
04a9568487
Implementing all [E]xception tests.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
d76050c713
Implementing all [S]uccess tests.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
401cdb3b0e
Shuffling existing TEST_CASEs into systematic matrix.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
1f80387f4b
Improved labeling of TEST_CASEs.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
bb82add4b0
Adding in vptr_deleter_guard_flag.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
5ab34305ae
New tests/core/smart_holder_poc_test.cpp, using Catch2.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
84bdaebf57
Adding from_shared_ptr. Some polishing.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
2a94c687ea
Adding from/as unique_ptr<T> and unique_ptr<T, D>.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
d1f94e498d
Adding vptr_deleter.
2021-02-09 06:47:04 -08:00
Ralf W. Grosse-Kunstleve
72d1b61176
Snapshot of WIP, TODO: shared_ptr deleter with on/off switch
2021-02-09 06:47:04 -08:00