summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2003-02-20 20:32:11 (GMT)
committerThomas Heller <theller@ctypes.org>2003-02-20 20:32:11 (GMT)
commit850566b644142f8698d691782e7ef3fa8d7a6cf8 (patch)
treeb850dcff4a7cee489e99e50f639506d7cafeaa5b /Objects
parent81e26590e4881d8271945e7b305893312326d0ef (diff)
downloadcpython-850566b644142f8698d691782e7ef3fa8d7a6cf8.zip
cpython-850566b644142f8698d691782e7ef3fa8d7a6cf8.tar.gz
cpython-850566b644142f8698d691782e7ef3fa8d7a6cf8.tar.bz2
Strange control flow in PyInt_AsLong. When nb_int is called inside
the PyInt_AsLong function, and this returns a long, the value is first retrieved with PyLong_AsLong, but afterwards overwritten by a call to PyInt_AS_LONG. Fixes SF #690253.
Diffstat (limited to 'Objects')
-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
{