[Python-checkins] cpython (2.7): 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/4ca84a3e37d7
changeset:   102688:4ca84a3e37d7
branch:      2.7
parent:      102683:85b35300f200
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.
 
 - In the curses module, raise an error if window.getstr() or window.instr() is
diff --git a/Modules/_sre.c b/Modules/_sre.c
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -3438,10 +3438,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