summaryrefslogtreecommitdiffstats
path: root/Parser/asdl_c.py
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2024-05-09 22:30:14 (GMT)
committerGitHub <noreply@github.com>2024-05-09 22:30:14 (GMT)
commit68fbc00dc870f6a8dcbecd2ec19298e21015867f (patch)
tree64510f6aeda5d45d63c36142818b9d25f03750d5 /Parser/asdl_c.py
parent98ff3f65c0232f31df89ebb52b244625ec9e3eb6 (diff)
downloadcpython-68fbc00dc870f6a8dcbecd2ec19298e21015867f.zip
cpython-68fbc00dc870f6a8dcbecd2ec19298e21015867f.tar.gz
cpython-68fbc00dc870f6a8dcbecd2ec19298e21015867f.tar.bz2
gh-118851: Default ctx arguments to AST constructors to Load() (#118854)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Parser/asdl_c.py')
-rwxr-xr-xParser/asdl_c.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 11d59fa..9961d23 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -1022,6 +1022,13 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
goto set_remaining_cleanup;
}
}
+ else if (type == state->expr_context_type) {
+ // special case for expr_context: default to Load()
+ res = PyObject_SetAttr(self, name, state->Load_singleton);
+ if (res < 0) {
+ goto set_remaining_cleanup;
+ }
+ }
else {
// simple field (e.g., identifier)
if (PyErr_WarnFormat(