diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-25 13:14:55 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-25 13:14:55 (GMT) |
commit | 27ba8864a491cd2b2877c41c70b867d92161f85b (patch) | |
tree | 7a42fcd42622a24a4e9f067a01860091ff008d8f | |
parent | 70223d9b09edf4cacc8267bdd588c3265e039233 (diff) | |
download | cpython-27ba8864a491cd2b2877c41c70b867d92161f85b.zip cpython-27ba8864a491cd2b2877c41c70b867d92161f85b.tar.gz cpython-27ba8864a491cd2b2877c41c70b867d92161f85b.tar.bz2 |
Issue #27118: Clean up Py_XINCREF/Py_XDECREF in typeobject.c.
Patch by Xiang Zhang.
-rw-r--r-- | Objects/typeobject.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 9e7b4e6..f869c8d 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -460,7 +460,7 @@ type_module(PyTypeObject *type, void *context) PyErr_Format(PyExc_AttributeError, "__module__"); return 0; } - Py_XINCREF(mod); + Py_INCREF(mod); return mod; } else { @@ -500,7 +500,7 @@ type_abstractmethods(PyTypeObject *type, void *context) PyErr_SetObject(PyExc_AttributeError, message); return NULL; } - Py_XINCREF(mod); + Py_INCREF(mod); return mod; } @@ -1534,7 +1534,6 @@ class_name(PyObject *cls) 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 @@ slot_sq_item(PyObject *self, Py_ssize_t i) 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; } } |