Ralf W. Grosse-Kunstleve
463788af26
Bringing back .clang-format, the previous rm was a bad idea.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
f066e43052
Removing .clang-format before git rebase master (where the file was added).
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
c29134cdf9
Adding test_classh_inheritance, currently failing (passes with class_).
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
238cc1222b
Adding & using PYBIND11_CLASSH_TYPE_CASTERS define.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
1c6be1dc72
Using pybind11/detail/classh_type_casters.h from test_classh_wip.cpp.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
9b1c7e7579
Copying classh type_casters from test_classh_wip.cpp UNMODIFIED, as a baseline for generalizing the code.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
20fe4e9319
Moving factored-out make_constructor to test_classh_wip.cpp, restoring previous version of cast.h. This is currently the most practical approach. See PR #2798 for background.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
07fbe0f417
Factoring out find_existing_python_instance().
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
d014eca1d8
Adding minor comment (change to internals needed to distinguish uninitialized/disowned in error message).
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
f21dac6b5b
Inserting additional assert to ensure a returned unique_ptr is always a new Python instance.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
3ebb723146
Using factored-out make_constructor (PR #2798 ), removing duplicate code.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
f78ac3c911
Fixing clang-format oversight.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
e7e136b535
Using type_caster_base<mpty>::src_and_type directly, removing copy. Also renaming one cast to cast_const_raw_ptr, for clarity.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
71409b5624
Cosmetical change around helper functions.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
07ed8aaab1
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-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
e26bd404c4
Calling deregister_instance after disowning via unique_ptr.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
4f135ce851
Making test_type_caster_bare_interface_demo.cpp slightly more realistic, ASAN, MSAN, UBSAN clean.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
1ac08dbc5e
Fixing bugs discovered by ASAN. The code is now ASAN, MSAN, UBSAN clean.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
c3627d2195
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-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
f47fe70bfc
static handle cast implementations for rtrn_uqmp, rtrn_uqcp.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
60597f3db3
Adding MISSING comments in operator std::unique_ptr<mpty[ const]>.
2021-01-29 14:11:55 -08:00
Ralf W. Grosse-Kunstleve
034c95caf3
static handle cast implementations for rtrn_shmp, rtrn_shcp.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
ccf594376a
Adding comment re potential use_count data race.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
31838564e2
Pure clang-format change (applied to original type_caster_generic::cast).
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
783852aa22
Copying type_caster_generic::cast into type_caster<mpty> as-is (preparation for handling smart pointers).
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
134552a328
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-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
06f9ba9d94
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-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
59030f0155
static cast handle for rtrn_cptr works by simply dropping in code from type_caster_base (marked with comments).
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
bb1b3d17ad
Systematically setting mtxt for all rtrn_mpty_* functions (preparation, the values are not actually used yet).
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
8b58e210db
flake8 cleanup
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
8570bc0098
Fixing oversight (discovered by flake8).
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
cbef095cd5
Pure clang-format --style=file -i
change, with two clang-format off
directives.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
788c80ff59
Pure clang-format --style=file -i
change.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
57b8fafc43
Retrieving smart_holder pointer in type_caster<std::unique_ptr<mpty[ const]>>::load, and using it cast_op operators.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
74678a7cb1
Improved error messaging: Cannot disown nullptr (as_unique_ptr).
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
98e3c5abb9
Retrieving smart_holder pointer in type_caster<std::shared_ptr<mpty[ const]>>::load, and using it cast_op operators.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
49994070d8
Factoring out smart_holder_type_caster_load.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
ed6c890776
Retrieving smart_holder pointer in type_caster<mpty>::load, and using it cast_op operators.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
bbca0142d8
Adding rvalue_ref, renaming const_value_ref to lvalue_ref & removing const.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
36ebf1e7c5
Adding isinstance<mpty> in type_caster::load functions.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
08fe834c4b
Adding mpty::mtxt string member.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
1a0dcf4695
Hard-coding smart_holder into classh.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
32d2967b0c
classh.h: renaming of class_ to classh + namespace; forking test_classh_wip from test_type_caster_bare_interface_demo.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
5248494ba0
Pure copy of class class_
implementation in pybind11.h (master commit 98f1bbb800
).
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
38e949880a
Adding unique_ptr<mpty>, unique_ptr<mpty const> casters.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
724a83e1d2
Adding shared_ptr<mpty>, shared_ptr<mpty const> casters.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
2f53e85d6a
Adding type_caster_bare_interface_demo.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
abc5e2e9ff
Removing stray file.
2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
998c8c93d7
Removing obsolete and very incomplete test (replaced by Catch2-based test).
2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
b63f4db0bc
Converting from methods to factory functions (no functional change).
2021-01-29 14:11:53 -08:00