[Python-checkins] cpython: Fix refcount.

raymond.hettinger python-checkins at python.org
Sun Sep 13 08:41:28 CEST 2015


https://hg.python.org/cpython/rev/3eaeb280d8e5
changeset:   97972:3eaeb280d8e5
user:        Raymond Hettinger <python at rcn.com>
date:        Sun Sep 13 02:41:18 2015 -0400
summary:
  Fix refcount.

files:
  Modules/_collectionsmodule.c |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -616,11 +616,14 @@
 deque_repeat(dequeobject *deque, Py_ssize_t n)
 {
     dequeobject *new_deque;
+    PyObject *rv;
 
     new_deque = (dequeobject *)deque_copy((PyObject *) deque);
     if (new_deque == NULL)
         return NULL;
-    return deque_inplace_repeat(new_deque, n);
+    rv = deque_inplace_repeat(new_deque, n);
+    Py_DECREF(new_deque);
+    return rv;
 }
 
 /* The rotate() method is part of the public API and is used internally

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list