[issue40378] ast.parse fails to trigger SyntaxWarning that normal execution does

2020-04-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Compilation includes the following stages: 1. Tokenizing. 2. Creating CST (concrete syntax tree). 3. Creating AST (abstract syntax tree). 4. Optimizing AST. 5. Building symtable. 6. Generating bytecode. 7. Optimizing bytecode. ast.parse() only includes

[issue40378] ast.parse fails to trigger SyntaxWarning that normal execution does

2020-04-24 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: > This does seem like a bug and prematurely closed, I'm a bit disappointed in > the current resolution I would love to see it moved as a new step in the execution pipeline that we cane extend easily and use externally (like PyAST_Validate). But I'm not

[issue40378] ast.parse fails to trigger SyntaxWarning that normal execution does

2020-04-24 Thread Anthony Sottile
Anthony Sottile added the comment: I would really like to be able to trigger all warnings consistently and statically without executing the code. This is useful (for instance) for this simple script which validates the ast:

[issue40378] ast.parse fails to trigger SyntaxWarning that normal execution does

2020-04-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is not a bug. Execution includes more stages than ast.parse(). -- nosy: +serhiy.storchaka resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue40378] ast.parse fails to trigger SyntaxWarning that normal execution does

2020-04-24 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: This is probably because that these warnings raised during code generation, rather then AST Validation / generation. -- nosy: +BTaskaya ___ Python tracker

[issue40378] ast.parse fails to trigger SyntaxWarning that normal execution does

2020-04-24 Thread Anthony Sottile
New submission from Anthony Sottile : 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)")