[New-bugs-announce] [issue45781] Deleting __debug__ should be an SyntaxError

Carl Friedrich Bolz-Tereick report at bugs.python.org
Thu Nov 11 04:45:11 EST 2021


New submission from Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>:

Right now, deleting __debug__ is not prevented:

>>> def f():
...     del __debug__
... 

Of course actually executing it doesn't work:

>>> del __debug__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name '__debug__' is not defined


Compare with assigning to __debug__:

>>> def f():
...     __debug__ = 1
... 
  File "<stdin>", line 2
SyntaxError: cannot assign to __debug__

----------
messages: 406149
nosy: Carl.Friedrich.Bolz
priority: normal
severity: normal
status: open
title: Deleting __debug__ should be an SyntaxError

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45781>
_______________________________________


More information about the New-bugs-announce mailing list