diff options
Diffstat (limited to 'Objects/complexobject.c')
-rw-r--r-- | Objects/complexobject.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c index a49037783be..d983a30901d 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -6,8 +6,10 @@ /* Submitted by Jim Hugunin */ #include "Python.h" +#include "pycore_object.h" // _PyObject_Init() #include "structmember.h" // PyMemberDef + /*[clinic input] class complex "PyComplexObject *" "&PyComplex_Type" [clinic start generated code]*/ @@ -229,13 +231,12 @@ complex_subtype_from_c_complex(PyTypeObject *type, Py_complex cval) PyObject * PyComplex_FromCComplex(Py_complex cval) { - PyComplexObject *op; - /* Inline PyObject_New */ - op = (PyComplexObject *) PyObject_MALLOC(sizeof(PyComplexObject)); - if (op == NULL) + PyComplexObject *op = PyObject_MALLOC(sizeof(PyComplexObject)); + if (op == NULL) { return PyErr_NoMemory(); - (void)PyObject_INIT(op, &PyComplex_Type); + } + _PyObject_Init((PyObject*)op, &PyComplex_Type); op->cval = cval; return (PyObject *) op; } |