Fix test case with __new__ (#3285)

This commit is contained in:
Aaron Gokaslan 2021-09-20 16:03:21 -04:00 committed by GitHub
parent d0f3c51f01
commit 6e6975e217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,8 +63,9 @@ TEST_SUBMODULE(class_, m) {
.def_static("new_instance", &NoConstructor::new_instance, "Return an instance");
py::class_<NoConstructorNew>(m, "NoConstructorNew")
.def(py::init([](NoConstructorNew *self) { return self; })) // Need a NOOP __init__
.def_static("__new__", [](const py::object *) { return NoConstructorNew::new_instance(); } );
.def(py::init([](const NoConstructorNew &self) { return self; })) // Need a NOOP __init__
.def_static("__new__",
[](const py::object &) { return NoConstructorNew::new_instance(); });
// test_inheritance
class Pet {