https://github.com/python/cpython/commit/1330e91abea7b4cb60cbecd6d7a95ba4c7f71ed3
commit: 1330e91abea7b4cb60cbecd6d7a95ba4c7f71ed3
branch: main
author: Cody Maloney <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-11-22T15:27:30Z
summary:
gh-162428: Use the freelist for exact `complex()` constructor results (#162429)
files:
M Objects/complexobject.c
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 4d2b5dc8e4613f..8a8fc240dd80ba 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -415,6 +415,9 @@ complex_subtype_from_c_complex(PyTypeObject *type,
Py_complex cval)
{
PyObject *op;
+ if (type == &PyComplex_Type) {
+ return PyComplex_FromCComplex(cval);
+ }
op = type->tp_alloc(type, 0);
if (op != NULL)
((PyComplexObject *)op)->cval = cval;
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]