Skip to content

Commit 4489dc3

Browse files
miss-islingtonjohnslavikJelleZijlstra
authored
[3.14] gh-156909: Fix AST.__repr__ call getting the _fields attribute (GH-157490) (GH-157596) (GH-159232)
(cherry picked from commit ad0a18a) Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
1 parent cb2845e commit 4489dc3

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎Parser/asdl_c.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,8 +1577,8 @@ def visitModule(self, mod):
15771577
return PyUnicode_FromFormat("%s(...)", Py_TYPE(self)->tp_name);
15781578
}
15791579
1580-
PyObject *fields;
1581-
if (PyObject_GetOptionalAttr((PyObject *)Py_TYPE(self), state->_fields, &fields) < 0) {
1580+
PyObject *fields = PyObject_GetAttr((PyObject *)Py_TYPE(self), state->_fields);
1581+
if (!fields) {
15821582
Py_ReprLeave((PyObject *)self);
15831583
return NULL;
15841584
}

‎Python/Python-ast.c‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)