summaryrefslogtreecommitdiff
path: root/Objects/complexobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/complexobject.c')
-rw-r--r--Objects/complexobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 4367ff6570..d50a6eb202 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -882,6 +882,9 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
((i != NULL) && (nbi == NULL || nbi->nb_float == NULL))) {
PyErr_SetString(PyExc_TypeError,
"complex() argument must be a string or a number");
+ if (own_r) {
+ Py_DECREF(r);
+ }
return NULL;
}
if (PyComplex_Check(r)) {