]> granicus.if.org Git - python/commitdiff
bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551)
authorZackery Spytz <zspytz@gmail.com>
Tue, 26 Mar 2019 06:05:29 +0000 (00:05 -0600)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 26 Mar 2019 06:05:29 +0000 (08:05 +0200)
Misc/NEWS.d/next/Core and Builtins/2019-03-25-23-37-26.bpo-36430.sd9xxQ.rst [new file with mode: 0644]
Modules/itertoolsmodule.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-03-25-23-37-26.bpo-36430.sd9xxQ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-03-25-23-37-26.bpo-36430.sd9xxQ.rst
new file mode 100644 (file)
index 0000000..a65ee09
--- /dev/null
@@ -0,0 +1 @@
+Fix a possible reference leak in :func:`itertools.count`.
index 536f7fa6253a210f5830548885a6d4b97f056ea2..103029d251e0dae7bfd28863043d50299d6fec32 100644 (file)
@@ -4089,6 +4089,7 @@ itertools_count_impl(PyTypeObject *type, PyObject *long_cnt,
     lz = (countobject *)type->tp_alloc(type, 0);
     if (lz == NULL) {
         Py_XDECREF(long_cnt);
+        Py_DECREF(long_step);
         return NULL;
     }
     lz->cnt = cnt;