diff options
author | Dong-hee Na <donghee.na@python.org> | 2021-08-25 17:54:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-25 17:54:20 (GMT) |
commit | 551da597a0996b0fb3af425f48aa5bc63ea6b963 (patch) | |
tree | b25b0cd691a97c00ede8fba1005d99643b25b952 /Python/compile.c | |
parent | 24da544014f78e6f1440d5ce5c2d14794a020340 (diff) | |
download | cpython-551da597a0996b0fb3af425f48aa5bc63ea6b963.zip cpython-551da597a0996b0fb3af425f48aa5bc63ea6b963.tar.gz cpython-551da597a0996b0fb3af425f48aa5bc63ea6b963.tar.bz2 |
bpo-45000: Raise SyntaxError when try to delete __debug__ (GH-27947)
Automerge-Triggered-By: GH:pablogsal
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c index e651ca5..053915e 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2343,6 +2343,10 @@ forbidden_name(struct compiler *c, identifier name, expr_context_ty ctx) compiler_error(c, "cannot assign to __debug__"); return 1; } + if (ctx == Del && _PyUnicode_EqualToASCIIString(name, "__debug__")) { + compiler_error(c, "cannot delete __debug__"); + return 1; + } return 0; } |