summaryrefslogtreecommitdiffstats
path: root/Objects/intobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/intobject.c')
-rw-r--r--Objects/intobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c
index fee7e4e..611aedf 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -162,10 +162,10 @@ PyInt_AsLong(register PyObject *op)
if (PyLong_Check(io)) {
/* got a long? => retry int conversion */
val = PyLong_AsLong((PyObject *)io);
- if (PyErr_Occurred()) {
- Py_DECREF(io);
+ Py_DECREF(io);
+ if ((val == -1) && PyErr_Occurred())
return -1;
- }
+ return val;
}
else
{