mirror of
https://github.com/python/cpython.git
synced 2025-12-11 19:40:17 +00:00
Correctly allocate complex types with tp_alloc. (bug #1498638)
This commit is contained in:
parent
85ac850834
commit
6b50c63a23
1 changed files with 2 additions and 2 deletions
|
|
@ -188,7 +188,7 @@ complex_subtype_from_c_complex(PyTypeObject *type, Py_complex cval)
|
||||||
{
|
{
|
||||||
PyObject *op;
|
PyObject *op;
|
||||||
|
|
||||||
op = PyType_GenericAlloc(type, 0);
|
op = type->tp_alloc(type, 0);
|
||||||
if (op != NULL)
|
if (op != NULL)
|
||||||
((PyComplexObject *)op)->cval = cval;
|
((PyComplexObject *)op)->cval = cval;
|
||||||
return op;
|
return op;
|
||||||
|
|
@ -1023,7 +1023,7 @@ PyTypeObject PyComplex_Type = {
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
0, /* tp_init */
|
0, /* tp_init */
|
||||||
0, /* tp_alloc */
|
PyType_GenericAlloc, /* tp_alloc */
|
||||||
complex_new, /* tp_new */
|
complex_new, /* tp_new */
|
||||||
PyObject_Del, /* tp_free */
|
PyObject_Del, /* tp_free */
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue