summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Python/getargs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 6a50ef6..2bbafdb 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -670,8 +670,10 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
if (float_argument_error(arg))
return converterr("integer<n>", arg, msgbuf, bufsize);
iobj = PyNumber_Index(arg);
- if (iobj != NULL)
+ if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
if (ival == -1 && PyErr_Occurred())
return converterr("integer<n>", arg, msgbuf, bufsize);
*p = ival;