summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-11-04 23:09:40 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-11-04 23:09:40 (GMT)
commit6f97e493e1626d101c53472c239e28e3fae3b42a (patch)
tree3554b283c188722a63984d15c04864b62da12a9d /Objects/longobject.c
parent8c5e41559c6f9c3493a03b69325a02b89c2d6d94 (diff)
downloadcpython-6f97e493e1626d101c53472c239e28e3fae3b42a.zip
cpython-6f97e493e1626d101c53472c239e28e3fae3b42a.tar.gz
cpython-6f97e493e1626d101c53472c239e28e3fae3b42a.tar.bz2
long_true_divide(): decref its converted arguments. test_long_future.py
run in an infinite loop no longer grows. Thanks to Neal Norwitz for determining that test leaked!
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 5141d53..899c940 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -1615,12 +1615,15 @@ long_true_divide(PyObject *v, PyObject *w)
{
PyLongObject *a, *b;
double ad, bd;
- int aexp, bexp;
+ int aexp, bexp, failed;
CONVERT_BINOP(v, w, &a, &b);
ad = _PyLong_AsScaledDouble((PyObject *)a, &aexp);
bd = _PyLong_AsScaledDouble((PyObject *)b, &bexp);
- if ((ad == -1.0 || bd == -1.0) && PyErr_Occurred())
+ failed = (ad == -1.0 || bd == -1.0) && PyErr_Occurred();
+ Py_DECREF(a);
+ Py_DECREF(b);
+ if (failed)
return NULL;
if (bd == 0.0) {