diff options
author | Stéphane Wirtel <stephane@wirtel.be> | 2019-02-21 10:11:53 (GMT) |
---|---|---|
committer | Pablo Galindo <Pablogsal@gmail.com> | 2019-02-21 10:11:53 (GMT) |
commit | 3ad91673057d410bf9f8c53df6bb8aa18c4b68ca (patch) | |
tree | ca2e9969eec7990a9a91061e5b2814a08aee5dd5 /Python/ast.c | |
parent | ea6207d593832fe50dbca39e94c138abbd5d266d (diff) | |
download | cpython-3ad91673057d410bf9f8c53df6bb8aa18c4b68ca.zip cpython-3ad91673057d410bf9f8c53df6bb8aa18c4b68ca.tar.gz cpython-3ad91673057d410bf9f8c53df6bb8aa18c4b68ca.tar.bz2 |
bpo-36052: Raise a SyntaxError when assigning a value to __debug__ with := (GH-11958)
Trying to assign a value to __debug__ using the assignment operator is supposed to fail, but
a missing check for forbidden names when setting the context in the ast was preventing this behaviour.
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/ast.c b/Python/ast.c index e721ac1..62ff868 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1084,7 +1084,7 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n) return 0; break; case Name_kind: - if (ctx == Store) { + if (ctx == Store || ctx == NamedStore) { if (forbidden_name(c, e->v.Name.id, n, 0)) return 0; /* forbidden_name() calls ast_error() */ } |