* Alternative approach to #3807 that supports an important PyCLIF use case: `Base` not specified in `classh<Derived>` statement, but passing Derived as Base works anyway.
* NOtest_multiple_inheritance_getattr in test_class_sh_void_ptr_capsule.py (quick experiment)
* Revert "NOtest_multiple_inheritance_getattr in test_class_sh_void_ptr_capsule.py (quick experiment)"
This reverts commit e8f0749b89.
* Special handling of pybind11 objects to side-step try_as_void_ptr_capsule_get_pointer __getattr__ issues.
* Inspect `internals.registered_types_py` in `type_is_pybind11_class_()`
* Remove debug code in tests subdir.
* Clean up the modified `try_as_void_ptr_capsule_get_pointer()` implementation and new helper functions.
* Introduce `get_python_state_dict()`
* Conditional version bump for Python 3.12+
* Shuffle subexpressions to make the condition easier to understand (no change to logic).
* Make pybind11 ABI version 5 the minimum for Python 3.12+ (as suggested by @Lalaland)
* Add back condition for PYPY_VERSION, but keep it open for future PyPy versions.
* Fall back to simple `|| defined(PYPY_VERSION)`. `PY_VERSION_HEX` does not appear to be meaningful with PyPy.
* use C++17 syntax to get rid of recursive template instantiations for concatenating type signatures (#4587)
* Apply descr.h `src_loc` change (smart_holder PR #4022) to code added with master PR #4587
* Add test_class_sh_property_non_owning to CMakeLists.txt (fixes oversight in PR #4586)
* Resolve clang-tidy errors.
* clang-tidy auto fix
---------
Co-authored-by: Konstantin Bespalov <kos5tya@yandex.ru>
* Add test_class_sh_property_non_owning.cpp,py
Failing:
```
__________________________________________________________ test_persistent_holder __________________________________________________________
def test_persistent_holder():
h = m.DataFieldsHolder(2)
> c = h.vec_at(0).core_fld
E RuntimeError: Non-owning holder (loaded_as_shared_ptr).
h = <pybind11_tests.class_sh_property_non_owning.DataFieldsHolder object at 0x7fabab516470>
test_class_sh_property_non_owning.py:6: RuntimeError
__________________________________________________________ test_temporary_holder ___________________________________________________________
def test_temporary_holder():
d = m.DataFieldsHolder(2).vec_at(1)
> c = d.core_fld
E RuntimeError: Non-owning holder (loaded_as_shared_ptr).
d = <pybind11_tests.class_sh_property_non_owning.DataField object at 0x7fabab548770>
test_class_sh_property_non_owning.py:13: RuntimeError
```
* Introduce `shared_ptr_from_python(responsible_parent)` and use in all `property_cpp_function`s with `const shared_ptr<T> &` arguments.
Tests are incomplete.
* Complete tests.
* Add comment for `smart_holder_type_caster_load<T>::shared_ptr_from_python`
Without this, it's impossible to get feature parity between detection
mechanisms. Both the pkg-config file and the cmake config set their
versions, but the python probe script didn't provide an option for this.
So you could print the compiler flags for using it, but you could not
check what you got.
```
flake8...................................................................Failed
- hook id: flake8
- exit code: 1
pybind11/setup_helpers.py:177:13: B028 No explicit stacklevel keyword argument found. The warn method from the warnings module uses a stacklevel of 1 by default. This will only show a stack trace for the line on which the warn method is called. It is therefore recommended to use a stacklevel of 2 or greater to provide more information to the user.
warnings.warn("You cannot safely change the cxx_level after setting it!")
^
```
```
flake8...................................................................Failed
- hook id: flake8
- exit code: 1
pybind11/setup_helpers.py:177:13: B028 No explicit stacklevel keyword argument found. The warn method from the warnings module uses a stacklevel of 1 by default. This will only show a stack trace for the line on which the warn method is called. It is therefore recommended to use a stacklevel of 2 or greater to provide more information to the user.
warnings.warn("You cannot safely change the cxx_level after setting it!")
^
```