mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-23 13:45:10 +00:00
ba3f167a52
11 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Ralf W. Grosse-Kunstleve
|
bc3cd8a8a8
|
Splitting out include/pybind11/detail/pragma_warning_block.h (#2988)
* Splitting out include/pybind11/detail/pragma_warning_block.h * Always including pragma_warning_block.h before common.h (resolved 8 CI failures). |
||
Ralf W. Grosse-Kunstleve
|
6c922614ed
|
Adding reclaim_disowned logic & miscellaneous naming and documentation improvements. (#2943)
* Using new smart_holder::reclaim_disowned in smart_holder_type_caster for unique_ptr. * Systematically renaming was_disowned to is_disowned (because disowning is now reversible: reclaim_disowned). * Systematically renaming virtual_overrider_self_life_support to trampoline_self_life_support (to reuse existing terminology instead of introducing new one). * Systematically renaming test_class_sh_with_alias to test_class_sh_trampoline_basic. * Adding a Trampolines and std::unique_ptr section to README_smart_holder.rst. * MSVC compatibility. |
||
Ralf W. Grosse-Kunstleve
|
0b63dd0eb2
|
Adding initial README_smart_holder.rst. (#2936)
* Adding initial README_smart_holder.rst. * Adding README_smart_holder.rst to MANIFEST.in and test_files.py. |
||
Ralf W. Grosse-Kunstleve
|
5319ca3817
|
Using dynamic_cast<AliasType> to determine pointee_depends_on_holder_owner . (#2910)
* Adaption of PyCLIF virtual_py_cpp_mix test. * Removing ValueError: Ownership of instance with virtual overrides in Python cannot be transferred to C++. TODO: static_assert alias class needs to inherit from virtual_overrider_self_life_support. * Bringing back ValueError: "... instance cannot safely be transferred to C++.", but based on dynamic_cast<AliasType>. * Fixing oversight: adding test_class_sh_virtual_py_cpp_mix.cpp to cmake file. * clang <= 3.6 compatibility. * Fixing oversight: dynamic_raw_ptr_cast_if_possible needs special handling for To = void. Adding corresponding missing test in test_class_sh_virtual_py_cpp_mix. Moving dynamic_raw_ptr_cast_if_possible to separate header. * Changing py::detail::virtual_overrider_self_life_support to py::virtual_overrider_self_life_support. |
||
Ralf W. Grosse-Kunstleve
|
469792032a
|
Adding virtual_overrider_self_life_support. (#2902)
* Initial version of virtual_overrider_self_life_support (enables safely passing unique_ptr to C++). * Clang 3.6, 3.7 compatibility. * Adding missing default constructor. * Restoring test for exception for the case that virtual_overrider_self_life_support is not used. * Fixing oversight: Adding missing holder().ensure_was_not_disowned(). * Adding unit tests for new `struct smart_holder` member functions. * Moving virtual_overrider_self_life_support to separate include file, with iwyu cleanup. |
||
Ralf W. Grosse-Kunstleve
|
1bafd5db5f
|
Adding py::smart_holder (for smart-pointer interoperability). (#2672)
* Adding test_unique_ptr_member (for desired PyCLIF behavior). See also: https://github.com/pybind/pybind11/issues/2583 Does not build with upstream master or https://github.com/pybind/pybind11/pull/2047, but builds with https://github.com/RobotLocomotion/pybind11 and almost runs: ``` Running tests in directory "/usr/local/google/home/rwgk/forked/EricCousineau-TRI/pybind11/tests": ================================================================================= test session starts ================================================================================= platform linux -- Python 3.8.5, pytest-5.4.3, py-1.9.0, pluggy-0.13.1 rootdir: /usr/local/google/home/rwgk/forked/EricCousineau-TRI/pybind11/tests, inifile: pytest.ini collected 2 items test_unique_ptr_member.py .F [100%] ====================================================================================== FAILURES ======================================================================================= _____________________________________________________________________________ test_pointee_and_ptr_owner ______________________________________________________________________________ def test_pointee_and_ptr_owner(): obj = m.pointee() assert obj.get_int() == 213 m.ptr_owner(obj) with pytest.raises(ValueError) as exc_info: > obj.get_int() E Failed: DID NOT RAISE <class 'ValueError'> test_unique_ptr_member.py:17: Failed ============================================================================= 1 failed, 1 passed in 0.06s ============================================================================= ``` * unique_ptr or shared_ptr return * new test_variant_unique_shared with vptr_holder prototype * moving prototype code to pybind11/vptr_holder.h, adding type_caster specialization to make the bindings involving unique_ptr passing compile, but load and cast implementations are missing * disabling GitHub Actions on pull_request (for this PR) * disabling AppVeyor (for this PR) * TRIGGER_SEGSEV macro, annotations for GET_STACK (vptr::get), GET_INT_STACK (pointee) * adding test_promotion_of_disowned_to_shared * Copying tests as-is from xxx_value_ptr_xxx_holder branch. https://github.com/rwgk/pybind11/tree/xxx_value_ptr_xxx_holder Systematically exercising returning and passing unique_ptr<T>, shared_ptr<T> with unique_ptr, shared_ptr holder. Observations: test_holder_unique_ptr: make_unique_pointee OK pass_unique_pointee BUILD_FAIL (as documented) make_shared_pointee Abort free(): double free detected pass_shared_pointee RuntimeError: Unable to load a custom holder type from a default-holder instance test_holder_shared_ptr: make_unique_pointee Segmentation fault (#1138) pass_unique_pointee BUILD_FAIL (as documented) make_shared_pointee OK pass_shared_pointee OK * Copying tests as-is from xxx_value_ptr_xxx_holder branch. https://github.com/rwgk/pybind11/tree/xxx_value_ptr_xxx_holder Systematically exercising casting between shared_ptr<base>, shared_ptr<derived>. * Demonstration of Undefined Behavior in handling of shared_ptr holder. Based on https://godbolt.org/z/4fdjaW by jorgbrown@ (thanks Jorg!). * Additional demonstration of Undefined Behavior in handling of shared_ptr holder. * fixing up-down mixup in comment * Demonstration of Undefined Behavior in handling of polymorphic pointers. (This demo does NOT involve smart pointers at all, unlike the otherwise similar test_smart_ptr_private_first_base.) * minor test_private_first_base.cpp simplification (after discovering that this can be wrapped with Boost.Python, using boost::noncopyable) * pybind11 equivalent of Boost.Python test similar to reproducer under #1333 * Snapshot of WIP, TODO: shared_ptr deleter with on/off switch * Adding vptr_deleter. * Adding from/as unique_ptr<T> and unique_ptr<T, D>. * Adding from_shared_ptr. Some polishing. * New tests/core/smart_holder_poc_test.cpp, using Catch2. * Adding in vptr_deleter_guard_flag. * Improved labeling of TEST_CASEs. * Shuffling existing TEST_CASEs into systematic matrix. * Implementing all [S]uccess tests. * Implementing all [E]xception tests. * Testing of exceptions not covered by the from-as matrix. * Adding top-level comment. * Converting from methods to factory functions (no functional change). * Removing obsolete and very incomplete test (replaced by Catch2-based test). * Removing stray file. * Adding type_caster_bare_interface_demo. * Adding shared_ptr<mpty>, shared_ptr<mpty const> casters. * Adding unique_ptr<mpty>, unique_ptr<mpty const> casters. * Pure copy of `class class_` implementation in pybind11.h (master commit |
||
Dustin Spicuzza
|
c0fbb02c9f
|
Extract gil management functions to separate header (#2845) | ||
Ralf W. Grosse-Kunstleve
|
0c42250a4e
|
Splitting out detail/type_caster_base.h from cast.h, with iwyu cleanup. (#2841)
* Splitting out detail/type_caster_base.h from cast.h. * Include cleanup guided by include-what-you-use 0.12 based on clang version 9.0.1-11. |
||
Henry Schreiner
|
645d83813b
|
feat: typing support for helpers (#2588)
* feat: basic typing support * docs: mention syncing as suggested by @rwgk * docs: update changelog * docs: copy of warning in limitations |
||
Henry Schreiner
|
81555ce61f
|
docs: Use README.rst in docs as home page (#2500) | ||
Henry Schreiner
|
fd61f5038e
|
feat: setup.py redesign and helpers (#2433)
* feat: setup.py redesign and helpers * refactor: simpler design with two outputs * refactor: helper file update and Windows support * fix: review points from @YannickJadoul * refactor: fixes to naming and more docs * feat: more customization points * feat: add entry point pybind11-config * refactor: Try Extension-focused method * refactor: rename alt/inplace to global * fix: allow usage with git modules, better docs * feat: global as an extra (@YannickJadoul's suggestion) * feat: single version location * fix: remove the requirement that setuptools must be imported first * fix: some review points from @wjacob * fix: use .in, add procedure to docs * refactor: avoid monkeypatch copy * docs: minor typos corrected * fix: minor points from @YannickJadoul * fix: typo on Windows C++ mode * fix: MSVC 15 update 3+ have c++14 flag See <https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=vs-2019> * docs: discuss making SDists by hand * ci: use pep517.build instead of manual setup.py * refactor: more comments from @YannickJadoul * docs: updates from @ktbarrett * fix: change to newly recommended tool instead of pep517.build This was intended as a proof of concept; build seems to be the correct replacement. See https://github.com/pypa/pep517/pull/83 * docs: updates from @wjakob * refactor: dual version locations * docs: typo spotted by @wjakob |