[Python-checkins] cpython (3.3): do not decref value borrowed from list (closes #27774)

benjamin.peterson python-checkins at python.org
Tue Aug 16 01:05:28 EDT 2016


https://hg.python.org/cpython/rev/cbf2a05648b3
changeset:   102689:cbf2a05648b3
branch:      3.3
parent:      102646:54c74212db91
user:        Benjamin Peterson <benjamin at python.org>
date:        Mon Aug 15 22:01:41 2016 -0700
summary:
  do not decref value borrowed from list (closes #27774)

files:
  Misc/NEWS      |  2 ++
  Modules/_sre.c |  4 +---
  2 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -29,6 +29,8 @@
 Library
 -------
 
+- Issue #27774: Fix possible Py_DECREF on unowned object in _sre.
+
 - Issue #27760: Fix possible integer overflow in binascii.b2a_qp.
 
 - Issue #27758: Fix possible integer overflow in the _csv module for large record
diff --git a/Modules/_sre.c b/Modules/_sre.c
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -3401,10 +3401,8 @@
         if (!key)
             goto failed;
         value = match_getslice(self, key, def);
-        if (!value) {
-            Py_DECREF(key);
+        if (!value)
             goto failed;
-        }
         status = PyDict_SetItem(result, key, value);
         Py_DECREF(value);
         if (status < 0)

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


More information about the Python-checkins mailing list