mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Use identifier API for PyObject_GetAttrString.
This commit is contained in:
parent
794d567b17
commit
1ee1b6fe0d
28 changed files with 499 additions and 357 deletions
|
|
@ -14,6 +14,8 @@ static int numfree = 0;
|
|||
#define PyMethod_MAXFREELIST 256
|
||||
#endif
|
||||
|
||||
_Py_identifier(__name__);
|
||||
|
||||
PyObject *
|
||||
PyMethod_Function(PyObject *im)
|
||||
{
|
||||
|
|
@ -226,7 +228,7 @@ method_repr(PyMethodObject *a)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
funcname = PyObject_GetAttrString(func, "__name__");
|
||||
funcname = _PyObject_GetAttrId(func, &PyId___name__);
|
||||
if (funcname == NULL) {
|
||||
if (!PyErr_ExceptionMatches(PyExc_AttributeError))
|
||||
return NULL;
|
||||
|
|
@ -240,7 +242,7 @@ method_repr(PyMethodObject *a)
|
|||
if (klass == NULL)
|
||||
klassname = NULL;
|
||||
else {
|
||||
klassname = PyObject_GetAttrString(klass, "__name__");
|
||||
klassname = _PyObject_GetAttrId(klass, &PyId___name__);
|
||||
if (klassname == NULL) {
|
||||
if (!PyErr_ExceptionMatches(PyExc_AttributeError))
|
||||
return NULL;
|
||||
|
|
@ -542,7 +544,7 @@ instancemethod_repr(PyObject *self)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
funcname = PyObject_GetAttrString(func, "__name__");
|
||||
funcname = _PyObject_GetAttrId(func, &PyId___name__);
|
||||
if (funcname == NULL) {
|
||||
if (!PyErr_ExceptionMatches(PyExc_AttributeError))
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue