summaryrefslogtreecommitdiff
path: root/Objects/complexobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/complexobject.c')
-rw-r--r--Objects/complexobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 236f4d5242..740499319a 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -522,6 +522,8 @@ complex_coerce(PyObject **pv, PyObject **pw)
}
else if (PyLong_Check(*pw)) {
cval.real = PyLong_AsDouble(*pw);
+ if (cval.real == -1.0 && PyErr_Occurred())
+ return -1;
*pw = PyComplex_FromCComplex(cval);
Py_INCREF(*pv);
return 0;