gh-106521: Remove _PyObject_LookupAttr() function (GH-106642)

This commit is contained in:
Serhiy Storchaka 2023-07-12 08:57:10 +03:00 committed by GitHub
parent e8ab0096a5
commit be1b968dc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 351 additions and 352 deletions

View file

@ -419,7 +419,7 @@ match_class_attr(PyThreadState *tstate, PyObject *subject, PyObject *type,
return NULL;
}
PyObject *attr;
(void)_PyObject_LookupAttr(subject, name, &attr);
(void)PyObject_GetOptionalAttr(subject, name, &attr);
return attr;
}
@ -454,7 +454,7 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type,
// First, the positional subpatterns:
if (nargs) {
int match_self = 0;
if (_PyObject_LookupAttr(type, &_Py_ID(__match_args__), &match_args) < 0) {
if (PyObject_GetOptionalAttr(type, &_Py_ID(__match_args__), &match_args) < 0) {
goto fail;
}
if (match_args) {
@ -2414,7 +2414,7 @@ import_from(PyThreadState *tstate, PyObject *v, PyObject *name)
PyObject *x;
PyObject *fullmodname, *pkgname, *pkgpath, *pkgname_or_unknown, *errmsg;
if (_PyObject_LookupAttr(v, name, &x) != 0) {
if (PyObject_GetOptionalAttr(v, name, &x) != 0) {
return x;
}
/* Issue #17636: in case this failed because of a circular relative