[issue21385] in debug mode, compile(ast) fails with an assertion error if an AST node has no line number information

STINNER Victor report at bugs.python.org
Tue May 13 01:45:25 CEST 2014


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 <report at bugs.python.org>
<http://bugs.python.org/issue21385>
_______________________________________


More information about the Python-bugs-list mailing list