summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-07-12 05:57:10 (GMT)
committerGitHub <noreply@github.com>2023-07-12 05:57:10 (GMT)
commitbe1b968dc1e63c3c68e161ddc5a05eb064833440 (patch)
tree8689ba9f656854b83bf24b82de4fc471437a51ab /Python/bltinmodule.c
parente8ab0096a583184fe24dfbc39eff70d270c8e6f4 (diff)
downloadcpython-be1b968dc1e63c3c68e161ddc5a05eb064833440.zip
cpython-be1b968dc1e63c3c68e161ddc5a05eb064833440.tar.gz
cpython-be1b968dc1e63c3c68e161ddc5a05eb064833440.tar.bz2
gh-106521: Remove _PyObject_LookupAttr() function (GH-106642)
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 20a86fc..7d77fd5 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -34,7 +34,7 @@ update_bases(PyObject *bases, PyObject *const *args, Py_ssize_t nargs)
}
continue;
}
- if (_PyObject_LookupAttr(base, &_Py_ID(__mro_entries__), &meth) < 0) {
+ if (PyObject_GetOptionalAttr(base, &_Py_ID(__mro_entries__), &meth) < 0) {
goto error;
}
if (!meth) {
@@ -175,7 +175,7 @@ builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
}
/* else: meta is not a class, so we cannot do the metaclass
calculation, so we will use the explicitly given object as it is */
- if (_PyObject_LookupAttr(meta, &_Py_ID(__prepare__), &prep) < 0) {
+ if (PyObject_GetOptionalAttr(meta, &_Py_ID(__prepare__), &prep) < 0) {
ns = NULL;
}
else if (prep == NULL) {
@@ -1160,7 +1160,7 @@ builtin_getattr_impl(PyObject *module, PyObject *object, PyObject *name,
PyObject *result;
if (default_value != NULL) {
- if (_PyObject_LookupAttr(object, name, &result) == 0) {
+ if (PyObject_GetOptionalAttr(object, name, &result) == 0) {
return Py_NewRef(default_value);
}
}
@@ -1209,7 +1209,7 @@ builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name)
{
PyObject *v;
- if (_PyObject_LookupAttr(obj, name, &v) < 0) {
+ if (PyObject_GetOptionalAttr(obj, name, &v) < 0) {
return NULL;
}
if (v == NULL) {
@@ -2465,7 +2465,7 @@ builtin_vars_impl(PyObject *module, PyObject *object)
d = _PyEval_GetFrameLocals();
}
else {
- if (_PyObject_LookupAttr(object, &_Py_ID(__dict__), &d) == 0) {
+ if (PyObject_GetOptionalAttr(object, &_Py_ID(__dict__), &d) == 0) {
PyErr_SetString(PyExc_TypeError,
"vars() argument must have __dict__ attribute");
}