summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-05-09 22:52:42 (GMT)
committerGitHub <noreply@github.com>2024-05-09 22:52:42 (GMT)
commit00ec116883f71d51b4f27fe7f6ea98cf1f176e6e (patch)
tree66c3c6f2b583c894fc6e32499ac5dbe684cd252e /Parser
parent982c73a33edf6c1348812c1794a95c20c0c2d906 (diff)
downloadcpython-00ec116883f71d51b4f27fe7f6ea98cf1f176e6e.zip
cpython-00ec116883f71d51b4f27fe7f6ea98cf1f176e6e.tar.gz
cpython-00ec116883f71d51b4f27fe7f6ea98cf1f176e6e.tar.bz2
[3.13] gh-118851: Default ctx arguments to AST constructors to Load() (GH-118854) (#118871)
(cherry picked from commit 68fbc00dc870f6a8dcbecd2ec19298e21015867f) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Parser')
-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(