New submission from Batuhan Taskaya <isidenti...@gmail.com>:

import ast
t = ast.fix_missing_locations(ast.Expression(ast.Name("True", ast.Load())))
compile(t, "<t>", "eval")

compilation of this AST can crash the interpreter for 3.8+

test_constant_as_name (test.test_ast.AST_Tests) ... python: 
Python/compile.c:3559: compiler_nameop: Assertion 
`!_PyUnicode_EqualToASCIIString(name, "None") && 
!_PyUnicode_EqualToASCIIString(name, "True") && 
!_PyUnicode_EqualToASCIIString(name, "False")' failed.
Fatal Python error: Aborted

I've encountered this while running test suite of 'pytest' with the current 
master, so I guess there are some usages related this out there. IMHO we should 
validate this on the PyAST_Validate step to prevent this kind of crashes.

----------
messages: 370753
nosy: BTaskaya
priority: normal
severity: normal
status: open
title: Custom AST can crash Python (debug build)

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

Reply via email to