New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on AST with misordered linenos #92597
Comments
Simple repro: from ast import *
tree = Module(body=[
Import(names=[alias(name='builtins', lineno=1, col_offset=0)], lineno=1, col_offset=0),
Import(names=[alias(name='traceback', lineno=0, col_offset=0)], lineno=0, col_offset=1)
], type_ignores=[])
compile(tree, "x", "exec", dont_inherit=True)
|
944fffe is the first bad commit
|
Looks like the ast defaults the end_lineno to None, which then becomes 0 in the compiler. Maybe the ast should default it be equal to lineno? Or should None become -1 in c? |
Both, perhaps. |
cc @pablogsal |
That's what we do in some parts that deal with these information. I can prepare a PR |
The question is if we should manage this in the AST creation routines or in the compiler. I assume that the first is more resilient but what do others think? |
./python.exe -m ensurepip
./python.exe -m pip install pytest-cov
./python.exe -m pytest
Crashes with
Assertion failed: (i->i_end_lineno >= i->i_lineno), function write_location_info_long_form, file compile.c, line 7532.
lldb stack trace:
Your environment
I put print statements in that show the file it crashes on is
'/usr/local/lib/python3.11/site-packages/pytest_cov/plugin.py'
, but just running Python on that file doesn't reproduce the crash. I'll try to debug some more.The text was updated successfully, but these errors were encountered: