New submission from Saiyang Gou <gousaiyang...@gmail.com>:

ast.parse in Python 3.9 does not produce SyntaxError for assignment to 
__debug__:

```
>>> import ast
>>> ast.dump(ast.parse('__debug__ = 0'))
"Module(body=[Assign(targets=[Name(id='__debug__', ctx=Store())], 
value=Constant(value=0))], type_ignores=[])"
>>> exec('__debug__ = 0')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1
SyntaxError: cannot assign to __debug__
```

In Python 3.8 a SyntaxError was properly raised. Probably this is due to the 
new PEG parser.

----------
components: Library (Lib)
messages: 377717
nosy: gousaiyang
priority: normal
severity: normal
status: open
title: ast.parse in Python 3.9 does not produce SyntaxError for assignment to 
__debug__
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41897>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to