mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
Add a life support system for type_caster temporaries
This commit is contained in:
@@ -119,3 +119,11 @@ def test_override_static():
|
||||
assert isinstance(b, m.MyBase)
|
||||
assert isinstance(d1, m.MyDerived)
|
||||
assert isinstance(d2, m.MyDerived)
|
||||
|
||||
|
||||
def test_implicit_conversion_life_support():
|
||||
"""Ensure the lifetime of temporary objects created for implicit conversions"""
|
||||
assert m.implicitly_convert_argument(UserType(5)) == 5
|
||||
assert m.implicitly_convert_variable(UserType(5)) == 5
|
||||
|
||||
assert "outside a bound function" in m.implicitly_convert_variable_fail(UserType(5))
|
||||
|
||||
Reference in New Issue
Block a user