mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 23:22:01 +00:00
2b4fbbd521
* 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.
18 lines
309 B
Python
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
|