[New-bugs-announce] [issue40378] ast.parse fails to trigger SyntaxWarning that normal execution does

Anthony Sottile report at bugs.python.org
Fri Apr 24 14:18:04 EDT 2020


New submission from Anthony Sottile <asottile at umich.edu>:

compare the following:

```
if False: 'foo'(1)
```


$ python3.9
Python 3.9.0a5 (default, Mar 23 2020, 23:11:30) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> ast.parse(b"if False: 'foo'(1)")
<ast.Module object at 0x7ff87a03cca0>
>>> if False: 'foo'(1)
... 
<stdin>:1: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?


even with `PYTHONWARNINGS=error` no warning / error is raised

----------
messages: 367207
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: ast.parse fails to trigger SyntaxWarning that normal execution does
type: behavior
versions: Python 3.8, Python 3.9

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


More information about the New-bugs-announce mailing list