Skip to content

Commit 1330e91

Browse files
authored
gh-162428: Use the freelist for exact complex() constructor results (#162429)
1 parent a7c5099 commit 1330e91

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎Objects/complexobject.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,9 @@ complex_subtype_from_c_complex(PyTypeObject *type, Py_complex cval)
415415
{
416416
PyObject *op;
417417

418+
if (type == &PyComplex_Type) {
419+
return PyComplex_FromCComplex(cval);
420+
}
418421
op = type->tp_alloc(type, 0);
419422
if (op != NULL)
420423
((PyComplexObject *)op)->cval = cval;

0 commit comments

Comments
 (0)