gh-156909: Fix AST.__repr__ call getting the _fields attribute (GH-157490)

This commit is contained in:
Bartosz Sławecki authored and GitHub committed 2026-09-15 08:26:26 +02:00
1 parent c68ce16cee
commit 1bfcc3cc87
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -1480,8 +1480,8 @@ ast_repr_max_depth(AST_object *self, int depth)
return NULL;
}
PyObject *fields;
if (PyObject_GetOptionalAttr((PyObject *)Py_TYPE(self), state->_fields, &fields) < 0) {
PyObject *fields = PyObject_GetAttr((PyObject *)Py_TYPE(self), state->_fields);
if (!fields) {
return NULL;
}
+2 -2
View File
@@ -5792,8 +5792,8 @@ ast_repr_max_depth(AST_object *self, int depth)
return NULL;
}
PyObject *fields;
if (PyObject_GetOptionalAttr((PyObject *)Py_TYPE(self), state->_fields, &fields) < 0) {
PyObject *fields = PyObject_GetAttr((PyObject *)Py_TYPE(self), state->_fields);
if (!fields) {
return NULL;
}