bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551)

(cherry picked from commit 0523c39e77)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-03-25 23:26:42 -07:00 committed by GitHub
parent eb94e5b3ec
commit e0fe25be1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -0,0 +1 @@
Fix a possible reference leak in :func:`itertools.count`.

View File

@ -4027,6 +4027,7 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
lz = (countobject *)type->tp_alloc(type, 0);
if (lz == NULL) {
Py_XDECREF(long_cnt);
Py_DECREF(long_step);
return NULL;
}
lz->cnt = cnt;