STINNER Victor added the comment:
With the development version (Python 3.5), I reproduce the crash when Python is
compiled in debug mode:
$ ./python astlinenotest.py
python: Python/compile.c:3975: assemble_lnotab: Assertion `d_lineno >= 0'
failed.
Abandon (core dumped)
The problem is that astlinenotest.py creates an AST node without lineno
information, which makes an assertion to fail in the compiler.
In my astoptimizer project, I use this function to not have to worry of the
lineno:
def copy_lineno(node, new_node):
ast.fix_missing_locations(new_node)
ast.copy_location(new_node, node)
return new_node
----------
nosy: +haypo
title: Compiling modified AST crashes on debug build unless linenumbering
discarded -> in debug mode, compile(ast) fails with an assertion error if an
AST node has no line number information
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21385>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com