-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[BUG] Assertion error from encode_single_position
,
#6366
Comments
Thanks for the quick report. The failing lines are (apparently) here: That said, I pushed a rewrite of the position building code that should make it more robust. Could you try if that works for you? |
The meson build is what we use now. The setup.py is just there for compatibility purposes in case someone happens to be using it. After we have had a full release with the meson build if there seem to be no problems then we will remove it. I'm not sure why setup.py sets binding=False and I don't think that it was intentional that we changed that in the meson build. Apparently I set binding=False in flintlib/python-flint#35 which was about Cython 3's change to Does
I have just reproduced it locally using the commit cython 26fd2ba (current https://github.com/flintlib/python-flint/blob/53a1c3f62161d6137bcbcdbda02ee4bca411004a/bin/coverage.sh#L18 I have just tried ccc54f9 (current master, i.e. your suggested commit) and I can still reproduce it so that change hasn't fixed it:
I can also reproduce it by running that cython command directly: $ cython -M --fast-fail -3 -X embedsignature=True -X emit_code_comments=True -X linetrace=True /home/oscar/current/active/python-flint/src/flint/types/nmod.pyx -o src/flint/types/nmod.cpython-312-x86_64-linux-gnu.so.p/src/flint/types/nmod.pyx.c
Traceback (most recent call last):
File "/home/oscar/.pyenv/versions/python-flint-3.12/bin/cython", line 8, in <module>
sys.exit(setuptools_main())
^^^^^^^^^^^^^^^^^
File "/home/oscar/.pyenv/versions/3.12.0/envs/python-flint-3.12/lib/python3.12/site-packages/Cython/Compiler/Main.py", line 749, in setuptools_main
return main(command_line = 1)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/oscar/.pyenv/versions/3.12.0/envs/python-flint-3.12/lib/python3.12/site-packages/Cython/Compiler/Main.py", line 772, in main
result = compile(sources, options)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oscar/.pyenv/versions/3.12.0/envs/python-flint-3.12/lib/python3.12/site-packages/Cython/Compiler/Main.py", line 668, in compile
return compile_multiple(source, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oscar/.pyenv/versions/3.12.0/envs/python-flint-3.12/lib/python3.12/site-packages/Cython/Compiler/Main.py", line 642, in compile_multiple
result = run_pipeline(source, options,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oscar/.pyenv/versions/3.12.0/envs/python-flint-3.12/lib/python3.12/site-packages/Cython/Compiler/Main.py", line 529, in run_pipeline
err, enddata = Pipeline.run_pipeline(pipeline, source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oscar/.pyenv/versions/3.12.0/envs/python-flint-3.12/lib/python3.12/site-packages/Cython/Compiler/Pipeline.py", line 404, in run_pipeline
data = run(phase, data)
^^^^^^^^^^^^^^^^
File "/home/oscar/.pyenv/versions/3.12.0/envs/python-flint-3.12/lib/python3.12/site-packages/Cython/Compiler/Pipeline.py", line 386, in run
return phase(data)
^^^^^^^^^^^
File "/home/oscar/.pyenv/versions/3.12.0/envs/python-flint-3.12/lib/python3.12/site-packages/Cython/Compiler/Pipeline.py", line 50, in generate_pyx_code_stage
module_node.process_implementation(options, result)
File "/home/oscar/.pyenv/versions/3.12.0/envs/python-flint-3.12/lib/python3.12/site-packages/Cython/Compiler/ModuleNode.py", line 226, in process_implementation
self.generate_c_code(env, options, result)
File "/home/oscar/.pyenv/versions/3.12.0/envs/python-flint-3.12/lib/python3.12/site-packages/Cython/Compiler/ModuleNode.py", line 548, in generate_c_code
globalstate.finalize_main_c_code()
File "Cython/Compiler/Code.py", line 1464, in Cython.Compiler.Code.GlobalState.finalize_main_c_code
File "Cython/Compiler/Code.py", line 1495, in Cython.Compiler.Code.GlobalState.close_global_decls
File "Cython/Compiler/Code.py", line 1727, in Cython.Compiler.Code.GlobalState.generate_const_declarations
File "Cython/Compiler/Code.py", line 2005, in Cython.Compiler.Code.GlobalState.generate_codeobject_constants
File "/home/oscar/.pyenv/versions/3.12.0/envs/python-flint-3.12/lib/python3.12/site-packages/Cython/Compiler/ExprNodes.py", line 10259, in generate_codeobj
line_table = StringEncoding.bytes_literal(build_line_table(func.node_positions, first_lineno).encode('iso8859-1'), 'iso8859-1')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "Cython/Compiler/LineTable.py", line 16, in Cython.Compiler.LineTable.build_line_table
File "Cython/Compiler/LineTable.py", line 39, in Cython.Compiler.LineTable.encode_single_position
AssertionError: 38 >= 39 However I only see that failure in my PR branch and not with python-flint master: flintlib/python-flint#179. So I guess these are the lines you wanted to point to: |
Now I remember it was because binding=True made it 2-3x slower to get a coverage enabled build: #4425 (comment) That seems less of an issue now that we have meson with fast incremental parallel rebuilds. |
Thanks, I can also reproduce it with that branch. It's a bug. It considers 39 the first line of the function, but the first code in that function comes from the |
…@cfunc functions, i.e. the one of the outermost (first) decorator, not necessarily the function signature line. Closes cython#6366
…@cfunc functions, i.e. the one of the outermost (first) decorator, not necessarily the function signature line. Closes cython#6366
I confirm that this is fixed. Thanks! |
Describe the bug
Currently python-flint has a CI job that tests against Cython master branch to measure coverage (gh-6341). That job was passing but has recently (today?) started failing.
Code to reproduce the behaviour:
I don't have a simple reproducer but here is the error message:
Note that I am editing this source file so this might not be triggered by a very new change in Cython but this is only seen with Cython master branch and not with latest released Cython
Expected behaviour
No response
OS
No response
Python version
No response
Cython version
No response
Additional context
https://github.com/flintlib/python-flint/actions/runs/10567756039/job/29278457452?pr=179
The text was updated successfully, but these errors were encountered: