summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index a237899..d55b0be 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -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;
}