summaryrefslogtreecommitdiffstats
path: root/Parser
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 /Parser
parente8ab0096a583184fe24dfbc39eff70d270c8e6f4 (diff)
downloadcpython-be1b968dc1e63c3c68e161ddc5a05eb064833440.zip
cpython-be1b968dc1e63c3c68e161ddc5a05eb064833440.tar.gz
cpython-be1b968dc1e63c3c68e161ddc5a05eb064833440.tar.bz2
gh-106521: Remove _PyObject_LookupAttr() function (GH-106642)
Diffstat (limited to 'Parser')
-rwxr-xr-xParser/asdl_c.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index d4763ea..e9665dd 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -629,7 +629,7 @@ class Obj2ModVisitor(PickleVisitor):
def visitField(self, field, name, sum=None, prod=None, depth=0):
ctype = get_c_type(field.type)
- line = "if (_PyObject_LookupAttr(obj, state->%s, &tmp) < 0) {"
+ line = "if (PyObject_GetOptionalAttr(obj, state->%s, &tmp) < 0) {"
self.emit(line % field.name, depth)
self.emit("return 1;", depth+1)
self.emit("}", depth)
@@ -813,7 +813,7 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
Py_ssize_t i, numfields = 0;
int res = -1;
PyObject *key, *value, *fields;
- if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
+ if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
goto cleanup;
}
if (fields) {
@@ -887,7 +887,7 @@ ast_type_reduce(PyObject *self, PyObject *unused)
}
PyObject *dict;
- if (_PyObject_LookupAttr(self, state->__dict__, &dict) < 0) {
+ if (PyObject_GetOptionalAttr(self, state->__dict__, &dict) < 0) {
return NULL;
}
if (dict) {