]> granicus.if.org Git - python/commitdiff
Correctly allocate complex types with tp_alloc. (bug #1498638)
authorGeorg Brandl <georg@python.org>
Thu, 1 Jun 2006 08:27:32 +0000 (08:27 +0000)
committerGeorg Brandl <georg@python.org>
Thu, 1 Jun 2006 08:27:32 +0000 (08:27 +0000)
Objects/complexobject.c

index 17aef8faadd1f5a5adf2d0875b5f6739fa29994a..4c6ea39dca1fa9d8a907b7adca8d64f43d9605cb 100644 (file)
@@ -188,7 +188,7 @@ complex_subtype_from_c_complex(PyTypeObject *type, Py_complex cval)
 {
        PyObject *op;
 
-       op = PyType_GenericAlloc(type, 0);
+       op = type->tp_alloc(type, 0);
        if (op != NULL)
                ((PyComplexObject *)op)->cval = cval;
        return op;
@@ -1023,7 +1023,7 @@ PyTypeObject PyComplex_Type = {
        0,                                      /* tp_descr_set */
        0,                                      /* tp_dictoffset */
        0,                                      /* tp_init */
-       0,                                      /* tp_alloc */
+       PyType_GenericAlloc,                    /* tp_alloc */
        complex_new,                            /* tp_new */
        PyObject_Del,                           /* tp_free */
 };