mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Issue #27118: Clean up Py_XINCREF/Py_XDECREF in typeobject.c.
Patch by Xiang Zhang.
This commit is contained in:
parent
70223d9b09
commit
27ba8864a4
1 changed files with 4 additions and 5 deletions
|
|
@ -460,7 +460,7 @@ type_module(PyTypeObject *type, void *context)
|
||||||
PyErr_Format(PyExc_AttributeError, "__module__");
|
PyErr_Format(PyExc_AttributeError, "__module__");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Py_XINCREF(mod);
|
Py_INCREF(mod);
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -500,7 +500,7 @@ type_abstractmethods(PyTypeObject *type, void *context)
|
||||||
PyErr_SetObject(PyExc_AttributeError, message);
|
PyErr_SetObject(PyExc_AttributeError, message);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Py_XINCREF(mod);
|
Py_INCREF(mod);
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1534,7 +1534,6 @@ class_name(PyObject *cls)
|
||||||
PyObject *name = _PyObject_GetAttrId(cls, &PyId___name__);
|
PyObject *name = _PyObject_GetAttrId(cls, &PyId___name__);
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
Py_XDECREF(name);
|
|
||||||
name = PyObject_Repr(cls);
|
name = PyObject_Repr(cls);
|
||||||
}
|
}
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
|
|
@ -5776,8 +5775,8 @@ slot_sq_item(PyObject *self, Py_ssize_t i)
|
||||||
if (args != NULL) {
|
if (args != NULL) {
|
||||||
PyTuple_SET_ITEM(args, 0, ival);
|
PyTuple_SET_ITEM(args, 0, ival);
|
||||||
retval = PyObject_Call(func, args, NULL);
|
retval = PyObject_Call(func, args, NULL);
|
||||||
Py_XDECREF(args);
|
Py_DECREF(args);
|
||||||
Py_XDECREF(func);
|
Py_DECREF(func);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue