Traceback (most recent call last):
SyntaxError: cannot assign to __debug__
+>>> del __debug__
+Traceback (most recent call last):
+SyntaxError: cannot delete __debug__
+
>>> f() = 1
Traceback (most recent call last):
SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
--- /dev/null
+A :exc:`SyntaxError` is now raised when trying to delete :const:`__debug__`.
+Patch by Dong-hee Na.
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;
}