[Python-checkins] cpython: Issue #27342: Replaced some Py_XDECREFs with Py_DECREFs.

serhiy.storchaka python-checkins at python.org
Sat Jun 18 02:44:25 EDT 2016


https://hg.python.org/cpython/rev/52931189d7ee
changeset:   102079:52931189d7ee
parent:      102077:61bd6974405f
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sat Jun 18 09:44:03 2016 +0300
summary:
  Issue #27342: Replaced some Py_XDECREFs with Py_DECREFs.
Patch by Xiang Zhang.

files:
  Objects/rangeobject.c |  10 +++++-----
  Python/bltinmodule.c  |   4 ++--
  2 files changed, 7 insertions(+), 7 deletions(-)


diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -129,9 +129,9 @@
         return (PyObject *) obj;
 
     /* Failed to create object, release attributes */
-    Py_XDECREF(start);
-    Py_XDECREF(stop);
-    Py_XDECREF(step);
+    Py_DECREF(start);
+    Py_DECREF(stop);
+    Py_DECREF(step);
     return NULL;
 }
 
@@ -196,7 +196,7 @@
     /* if (lo >= hi), return length of 0. */
     cmp_result = PyObject_RichCompareBool(lo, hi, Py_GE);
     if (cmp_result != 0) {
-        Py_XDECREF(step);
+        Py_DECREF(step);
         if (cmp_result < 0)
             return NULL;
         return PyLong_FromLong(0);
@@ -225,9 +225,9 @@
     return result;
 
   Fail:
+    Py_DECREF(step);
     Py_XDECREF(tmp2);
     Py_XDECREF(diff);
-    Py_XDECREF(step);
     Py_XDECREF(tmp1);
     Py_XDECREF(one);
     return NULL;
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -2711,10 +2711,10 @@
     SETBUILTIN("zip",                   &PyZip_Type);
     debug = PyBool_FromLong(Py_OptimizeFlag == 0);
     if (PyDict_SetItemString(dict, "__debug__", debug) < 0) {
-        Py_XDECREF(debug);
+        Py_DECREF(debug);
         return NULL;
     }
-    Py_XDECREF(debug);
+    Py_DECREF(debug);
 
     return mod;
 #undef ADD_TO_ALL

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


More information about the Python-checkins mailing list