Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions tests/test_class_sh_trampoline_shared_from_this.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import sys
import weakref

import pytest
Expand Down Expand Up @@ -217,30 +216,17 @@ def test_multiple_registered_instances_for_same_pointee_recursive():
break # Comment out for manual leak checking (use `top` command).


# As of 2021-07-10 the pybind11 GitHub Actions valgrind build uses Python 3.9.
WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 = env.LINUX and sys.version_info == (3, 9)


def test_std_make_shared_factory():
class PySftMakeShared(m.Sft):
def __init__(self, history):
super().__init__(history, 0)

obj = PySftMakeShared("PySftMakeShared")
assert obj.history == "PySftMakeShared"
if WORKAROUND_ENABLING_ROLLBACK_OF_PR3068:
try:
m.pass_through_shd_ptr(obj)
except RuntimeError as e:
str_exc_info_value = str(e)
else:
str_exc_info_value = "RuntimeError NOT RAISED"
else:
with pytest.raises(RuntimeError) as exc_info:
m.pass_through_shd_ptr(obj)
str_exc_info_value = str(exc_info.value)
with pytest.raises(RuntimeError) as exc_info:
m.pass_through_shd_ptr(obj)
assert (
str_exc_info_value
str(exc_info.value)
== "smart_holder_type_casters load_as_shared_ptr failure: not implemented:"
" trampoline-self-life-support for external shared_ptr to type inheriting"
" from std::enable_shared_from_this."
Expand Down
Loading