Skip to content

Commit

Permalink
Do not intercept our own tp_init function (pybind11_object_init).
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Jan 30, 2024
1 parent bf9d647 commit 9cc3de1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/pybind11/detail/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ extern "C" int pybind11_object_init(PyObject *self, PyObject *, PyObject *);
/// Instance creation function for all pybind11 types. It only allocates space for the
/// C++ object, but doesn't call the constructor -- an `__init__` function must do that.
extern "C" inline PyObject *pybind11_object_new(PyTypeObject *type, PyObject *, PyObject *) {
if (type->tp_init != tp_init_intercepted) {
if (type->tp_init != tp_init_intercepted && type->tp_init != pybind11_object_init) {
(*derived_tp_init_registry())[type] = type->tp_init;
type->tp_init = tp_init_intercepted;
}
Expand Down

0 comments on commit 9cc3de1

Please sign in to comment.