bugfix: fixes a test suite bug in the __new__ example (#4698)

* bugfix: fixes a test suite bug in the __new__ example

* See https://github.com/pybind/pybind11/pull/4698#discussion_r1227107682

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
This commit is contained in:
Aaron Gokaslan 2023-07-12 16:20:08 -04:00 committed by GitHub
parent 2e5f5c4cf8
commit b33d06f615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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