From: Mark Dickinson Date: Mon, 21 Dec 2009 11:31:54 +0000 (+0000) Subject: Fix reference counts for test_long_and_overflow. X-Git-Tag: v2.7a2~134 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed02b3f34272e26417aca3445b9cdb3fd63a8dab;p=python Fix reference counts for test_long_and_overflow. --- diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 2bcf75446e..bc03940ce9 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -388,6 +388,8 @@ test_long_and_overflow(PyObject *self) return raiseTestError("test_long_and_overflow", "overflow was not set to 0"); + Py_DECREF(num); + /* a number smaller than LONG_MIN even on 64-bit platforms */ num = PyLong_FromString("-FFFFFFFFFFFFFFFFFFFFFFFF", NULL, 16); if (num == NULL) @@ -406,6 +408,8 @@ test_long_and_overflow(PyObject *self) return raiseTestError("test_long_and_overflow", "overflow was not set to 0"); + Py_DECREF(num); + num = PyLong_FromString("FF", NULL, 16); if (num == NULL) return NULL; @@ -423,6 +427,8 @@ test_long_and_overflow(PyObject *self) return raiseTestError("test_long_and_overflow", "overflow was set incorrectly"); + Py_DECREF(num); + Py_INCREF(Py_None); return Py_None; }