]> granicus.if.org Git - python/commitdiff
do not decref value borrowed from list (closes #27774)
authorBenjamin Peterson <benjamin@python.org>
Tue, 16 Aug 2016 05:01:41 +0000 (22:01 -0700)
committerBenjamin Peterson <benjamin@python.org>
Tue, 16 Aug 2016 05:01:41 +0000 (22:01 -0700)
Misc/NEWS
Modules/_sre.c

index b2f081c83564a5a1f23787ac5fc73548e5ce5368..8c7acaf6482f53c9be9d0afb6582e60494560e79 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -29,6 +29,8 @@ Core and Builtins
 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
index b1258eefc49771262ee27dc413e24080fa42b9b6..7b941ffdbc962d6e2214c685c23cf9ed93d6286a 100644 (file)
@@ -3401,10 +3401,8 @@ match_groupdict(MatchObject* self, PyObject* args, PyObject* kw)
         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)