Commit Graph

658 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
75f7eca26e Introducing 1. type_caster_for_class_, used in PYBIND11_MAKE_OPAQUE, and 2. default_holder_type, used in stl_bind.h. 2021-02-09 06:47:45 -08:00
Ralf W. Grosse-Kunstleve
99e9595a9c Introducing PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS. Using it in test_smart_ptr.cpp. With this test_smart_ptr builds with PYBIND11_USE_SMART_HOLDER_AS_DEFAULT and all but one test run successfully. 2021-02-09 06:47:45 -08:00
Ralf W. Grosse-Kunstleve
9c95dc4d8f Factoring out struct and class definitions into anonymous namespace. Preparation for building with PYBIND11_USE_SMART_HOLDER_AS_DEFAULT. 2021-02-09 06:47:45 -08:00
Ralf W. Grosse-Kunstleve
3134dfe779 Disabling shared_ptr&, shared_ptr* tests when building with PYBIND11_USE_SMART_HOLDER_AS_DEFAULT for now, pending work on smart_holder_type_caster<shared_ptr>. 2021-02-09 06:47:45 -08:00
Ralf W. Grosse-Kunstleve
8caf0f50df Adding initimpl::construct() overloads, resulting in test_class_sh_factory_constructors feature parity for py::class_ and py::classh. 2021-02-09 06:47:45 -08:00
Ralf W. Grosse-Kunstleve
b69b4a9f55 Converting as many py::class_ to py::classh as possible, not breaking tests. 2021-02-09 06:47:45 -08:00
Ralf W. Grosse-Kunstleve
1e4f0fdcaf Removing include/pybind11/detail/smart_holder_type_casters.h from CMakeLists.txt, test_files.py (since it does not exist in this branch). 2021-02-09 06:47:45 -08:00
Ralf W. Grosse-Kunstleve
3f5a9c9bf4 Adding test_class_sh_factory_constructors, reproducing test_factory_constructors failure. Using py::class_ in this commit, to be changed to py::classh for debugging. 2021-02-09 06:47:45 -08:00
Ralf W. Grosse-Kunstleve
f373e3d619 Fixing oversight introduced with commit 95425f13d6. 2021-02-09 06:47:44 -08:00
Ralf W. Grosse-Kunstleve
b69f9fed33 Removing test_type_caster_bare_interface, which was moved to the separate PR #2834. 2021-02-09 06:47:44 -08:00
Ralf W. Grosse-Kunstleve
ce79f9126d Introducing PYBIND11_USE_SMART_HOLDER_AS_DEFAULT macro (tested only undefined; there are many errors with the macro defined). 2021-02-09 06:47:44 -08:00
Ralf W. Grosse-Kunstleve
0f316720f7 Adding comment, simplifying naming, cmake addition. 2021-02-09 06:47:44 -08:00
Ralf W. Grosse-Kunstleve
0dfd3a6b7d Copying files as-is from branch test_unique_ptr_member (PR #2672). 2021-02-09 06:47:44 -08:00
Ralf W. Grosse-Kunstleve
72f52be256 Unification of unique_ptr, unique_ptr_with_deleter code in smart_holder_poc.h. Leads to more fitting error messages. Enables use of unique_ptr<T, D> smart_holder_type_casters also for unique_ptr<T>. 2021-02-09 06:47:08 -08:00
Ralf W. Grosse-Kunstleve
a9bfcbdcc3 Adding smart_holder_type_casters for unique_ptr with custom deleter. SEVERE CODE DUPLICATION. This commit is to establish a baseline for consolidating the unique_ptr code. 2021-02-09 06:47:08 -08:00
Ralf W. Grosse-Kunstleve
692270a017 Removing test_type_caster_bare_interface, which was moved to the separate PR #2834. 2021-02-09 06:47:08 -08:00
Ralf W. Grosse-Kunstleve
149e332b3e Adding classu alias for class_<U, std::unique_ptr<U>>. 2021-02-09 06:47:08 -08:00
Ralf W. Grosse-Kunstleve
742bc0eaf7 Replacing detail::is_smart_holder<H> in cast.h with detail::is_smart_holder_type_caster<T>.
Moving get_local_load_function_ptr, init_instance_for_type to smart_holder_type_caster_class_hooks.
Expanding static_assert in py::type::handle_of<> to accommodate smart_holder_type_casters.
2021-02-09 06:47:08 -08:00
Ralf W. Grosse-Kunstleve
87acc89b21 Reintroducing py::classh, this time as a simple alias for py::class_<U, py::smart_holder>. 2021-02-09 06:47:08 -08:00
Ralf W. Grosse-Kunstleve
c749d9b7fc Adding tests/pure_cpp/CMakeLists.txt. 2021-02-09 06:47:08 -08:00
Ralf W. Grosse-Kunstleve
d91f2190ee Adding new header files to tests/extra_python_package/test_files.py. 2021-02-09 06:47:08 -08:00
Ralf W. Grosse-Kunstleve
9077bcd1fc Explicitly define copy/move constructors/assignments. 2021-02-09 06:47:08 -08:00
Ralf W. Grosse-Kunstleve
a15797d50e CMake COMPARE NATURAL is not available with older versions. 2021-02-09 06:47:08 -08:00
Ralf W. Grosse-Kunstleve
f19e80881c Changing CMake file so that test_class_sh_module_local.py actually runs. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
505cd35c2b Adding new tests to CMake config, resetting CI config. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
e1ac502890 Renaming new tests/core subdirectory to tests/pure_cpp. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
ef8a13c280 Renaming test_type_caster_bare_interface_demo to test_type_caster_bare_interface. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
edfe8bfd71 Systematically renaming tests to use "class_sh" in the name. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
bda4178163 Renaming all "classh" to "smart_holder" in pybind11/detail/smart_holder_type_casters.h.
The user-facing macro is now PYBIND11_SMART_HOLDER_TYPE_CASTERS.
2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
e96c06e61a Renaming files in include directory, creating pybind11/smart_holder.h. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
661eeb381c Adding py::smart_holder support to py::class_, purging py::classh completely. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
23dc9b173c Moving several tests to github.com/rwgk/rwgk_tbx/tree/main/pybind11_tests
a2c2f88174

These tests are from experimenting, and for demonstrating UB in pybind11 multiple inheritance handling ("first_base"), to be fixed later.
2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
2d463aa3b6 Purging obsolete pybind11/vptr_holder.h and associated test. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
c9cb661fe3 Converting test_unique_ptr_member to using classh: fully working, ASAN, MSAN, UBSAN clean. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
c30cc404c9 Removing rtti_held from smart_holder. See updated comment. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
0f82a0b014 Adding smart_holder_type_caster_load::loaded_as_shared_ptr, currently bypassing smart_holder shared_ptr tracking completely, but the tests pass and are sanitizer clean. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
11690b0b91 Moving const after type name, for functions that cover a systematic scheme. NO functional changes. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
de945f854a Adopting systematic naming scheme from test_classh_wip. NO functional changes. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
235fa288b8 Pure renaming of function and variable names, for better generalization when convoluting with inheritance. NO functional changes. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
54fa191f20 Pure renaming of function names in test_classh_inheritance, similar to the systematic approach used in test_class_wip. NO functional changes. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
cbebb6da1f Tests for classh py::module_local() feature. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
c362b91a80 Minimal test covering classh_type_casters load_impl Case 2b. 2021-02-09 06:47:07 -08:00
Ralf W. Grosse-Kunstleve
82f619bdb2 Changes and tests covering classh_type_casters try_implicit_casts. 2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
4c7bb2612b Adding test_classh_inheritance, currently failing (passes with class_). 2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
d7efc9b8b1 Adding & using PYBIND11_CLASSH_TYPE_CASTERS define. 2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
1ef19a1e04 Using pybind11/detail/classh_type_casters.h from test_classh_wip.cpp. 2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
2a7d41c193 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-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
bad7199a02 Factoring out find_existing_python_instance(). 2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
2f8e01748b Adding minor comment (change to internals needed to distinguish uninitialized/disowned in error message). 2021-02-09 06:47:06 -08:00
Ralf W. Grosse-Kunstleve
a72e5f0c8f Inserting additional assert to ensure a returned unique_ptr is always a new Python instance. 2021-02-09 06:47:06 -08:00