pybind11/tests/test_class_sh_trampoline_unique_ptr.py
Ralf W. Grosse-Kunstleve 2b4fbbd521
Bug fix for virtual_overrider_self_life_support ASAN heap-use-after-free failure. (#2942)
* Porting subset of absltest code from reproducer provided by @elkhrt. Baseline for debugging ASAN heap-use-after-free.

* Moving Py_DECREF to resolve ASAN heap-use-after-free failure.

* Fixing trivial formatting issue.

* Workaround for clang 3.6 and 3.7.
2021-04-08 22:56:46 -07:00

18 lines
309 B
Python

# -*- coding: utf-8 -*-
import pybind11_tests.class_sh_trampoline_unique_ptr as m
class MyClass(m.Class):
def foo(self):
return 10
def clone(self):
return MyClass()
def test_py_clone_and_foo():
obj = MyClass()
assert obj.foo() == 10
assert m.clone_and_foo(obj) == 10