[issue41897] ast.parse in Python 3.9 does not produce SyntaxError for assignment to __debug__

Guido van Rossum report at bugs.python.org
Wed Sep 30 16:28:55 EDT 2020


Guido van Rossum <guido at python.org> added the comment:

We moved the check from the parser to the bytecode compiler. I don't think this should be a problem. Kudos for noticing though! :-)

```
>>> compile("__debug__ = 1", "<string>", "exec")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1
SyntaxError: cannot assign to __debug__
>>> 
```

----------
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list