[Python-checkins] cpython: Issue #27118: Clean up Py_XINCREF/Py_XDECREF in typeobject.c.

serhiy.storchaka python-checkins at python.org
Wed May 25 09:15:27 EDT 2016


https://hg.python.org/cpython/rev/3b4c3dda679a
changeset:   101490:3b4c3dda679a
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed May 25 16:14:55 2016 +0300
summary:
  Issue #27118: Clean up Py_XINCREF/Py_XDECREF in typeobject.c.
Patch by Xiang Zhang.

files:
  Objects/typeobject.c |  9 ++++-----
  1 files changed, 4 insertions(+), 5 deletions(-)


diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -460,7 +460,7 @@
             PyErr_Format(PyExc_AttributeError, "__module__");
             return 0;
         }
-        Py_XINCREF(mod);
+        Py_INCREF(mod);
         return mod;
     }
     else {
@@ -500,7 +500,7 @@
             PyErr_SetObject(PyExc_AttributeError, message);
         return NULL;
     }
-    Py_XINCREF(mod);
+    Py_INCREF(mod);
     return mod;
 }
 
@@ -1534,7 +1534,6 @@
     PyObject *name = _PyObject_GetAttrId(cls, &PyId___name__);
     if (name == NULL) {
         PyErr_Clear();
-        Py_XDECREF(name);
         name = PyObject_Repr(cls);
     }
     if (name == NULL)
@@ -5776,8 +5775,8 @@
             if (args != NULL) {
                 PyTuple_SET_ITEM(args, 0, ival);
                 retval = PyObject_Call(func, args, NULL);
-                Py_XDECREF(args);
-                Py_XDECREF(func);
+                Py_DECREF(args);
+                Py_DECREF(func);
                 return retval;
             }
         }

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


More information about the Python-checkins mailing list