From c6a917eeae60a544786dcf6a427535e096506d00 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sun, 30 Jun 2024 14:09:19 -0700 Subject: [PATCH] Add make_some_type() to test_wip (reproduces Segmentation fault in test_class). --- tests/test_wip.cpp | 2 ++ tests/test_wip.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/tests/test_wip.cpp b/tests/test_wip.cpp index a8e119c94..e34b85db5 100644 --- a/tests/test_wip.cpp +++ b/tests/test_wip.cpp @@ -16,4 +16,6 @@ TEST_SUBMODULE(wip, m) { py::class_(m, "SomeType").def(py::init([]() { return std::unique_ptr(new SomeType); })); + + m.def("make_some_type", []() { return std::unique_ptr(new SomeType); }); } diff --git a/tests/test_wip.py b/tests/test_wip.py index 3076c6fc7..6b5d7956f 100644 --- a/tests/test_wip.py +++ b/tests/test_wip.py @@ -10,3 +10,8 @@ def test_doc(): def test_some_type_ctor(): obj = m.SomeType() assert isinstance(obj, m.SomeType) + + +def test_make_some_type(): + obj = m.make_some_type() + assert isinstance(obj, m.SomeType)