summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/intobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c
index a3df3ba..b97e2bc 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -947,12 +947,14 @@ int_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (!PyLong_Check(tmp)) {
PyErr_SetString(PyExc_ValueError,
"value must convertable to an int");
+ Py_DECREF(tmp);
return NULL;
}
ival = PyLong_AsLong(tmp);
- if (ival == -1 && PyErr_Occurred())
+ if (ival == -1 && PyErr_Occurred()) {
+ Py_DECREF(tmp);
return NULL;
-
+ }
} else {
ival = ((PyIntObject *)tmp)->ob_ival;
}