mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-27 08:04:56 +00:00
* git merge --squash purge_internals_versions_4_5
* Remove PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT, set PYBIND11_INTERNALS_VERSION 7
* Remove all uses of PYBIND11_SMART_HOLDER_ENABLED under include/pybind11
* Remove obsolete PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT macro.
* Remove PYBIND11_SMART_HOLDER_ENABLED in ubench/holder_comparison.cpp
* Remove all uses of PYBIND11_SMART_HOLDER_ENABLED under tests/
* Remove `#define PYBIND11_SMART_HOLDER_ENABLED`
* Remove all uses of PYBIND11_SMART_HOLDER_TYPE_CASTERS under tests/
* Remove all uses of PYBIND11_TYPE_CASTER_BASE_HOLDER under tests/
* Add missing `#include <cstdint>`
Example error message (🐍 3.11 • ubuntu-latest • x64, GNU 13.3.0):
```
include/pybind11/detail/value_and_holder.h:56:52: error: ‘uint8_t’ is not a member of ‘std’; did you mean ‘wint_t’?
56 | inst->nonsimple.status[index] &= (std::uint8_t) ~instance::status_holder_constructed;
| ^~~~~~~
```
* Change PYBIND11_INTERNALS_VERSION to 106: It will be changed to 7 in a follow-on PR that actually changes the internals.
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
from pybind11_tests import class_sh_shared_ptr_copy_move as m
|
|
|
|
|
|
def test_shptr_copy():
|
|
txt = m.test_ShPtr_copy()[0].get_history()
|
|
assert txt == "FooShPtr_copy"
|
|
|
|
|
|
def test_smhld_copy():
|
|
txt = m.test_SmHld_copy()[0].get_history()
|
|
assert txt == "FooSmHld_copy"
|
|
|
|
|
|
def test_shptr_move():
|
|
txt = m.test_ShPtr_move()[0].get_history()
|
|
assert txt == "FooShPtr_move"
|
|
|
|
|
|
def test_smhld_move():
|
|
txt = m.test_SmHld_move()[0].get_history()
|
|
assert txt == "FooSmHld_move"
|
|
|
|
|
|
def _check_property(foo_typ, prop_typ, policy):
|
|
o = m.Outer()
|
|
name = f"{foo_typ}_{prop_typ}_{policy}"
|
|
history = f"Foo{foo_typ}_Outer"
|
|
f = getattr(o, name)
|
|
assert f.get_history() == history
|
|
# and try again to check that o did not get changed
|
|
f = getattr(o, name)
|
|
assert f.get_history() == history
|
|
|
|
|
|
def test_properties():
|
|
for prop_typ in ("readonly", "readwrite", "property_readonly"):
|
|
for foo_typ in ("ShPtr", "SmHld"):
|
|
for policy in ("default", "copy", "move"):
|
|
_check_property(foo_typ, prop_typ, policy)
|