mirror of
https://github.com/python/cpython.git
synced 2025-08-24 02:35:59 +00:00
bpo-45000: Raise SyntaxError when try to delete __debug__ (GH-27947) (GH-27957)
(cherry picked from commit 551da597a0
)
This commit is contained in:
parent
6ea6cf22e9
commit
32c1caa87f
3 changed files with 10 additions and 0 deletions
|
@ -2264,6 +2264,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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue