Repository navigation
[BUG] [HEADS UP] Cython build failure with Python 3.14.0a1 #6426
Copy link
Copy link
Closed
Labels
Description
Describe the bug
I try to build Cython 3.0.11 with Python 3.14.0a1 in Fedora Linux and get the following errors:
Error compiling Cython file:
------------------------------------------------------------
...
return op, pos
def p_binop_expr(s, ops, p_sub_expr):
n1 = p_sub_expr(s)
while s.sy in ops:
op, pos = p_binop_operator(s)
^
------------------------------------------------------------
Cython/Compiler/Parsing.py:99:35: Compiler crash in AnalyseExpressionsTransform
ModuleNode.body = StatListNode(Parsing.py:6:0)
StatListNode.stats[25] = StatListNode(Parsing.py:96:0)
StatListNode.stats[0] = CFuncDefNode(Parsing.py:96:0,
args = [...]/3,
modifiers = [...]/0,
outer_attrs = [...]/2,
visibility = 'private')
File 'Nodes.py', line 397, in analyse_expressions: StatListNode(Parsing.py:97:4,
is_terminator = True)
File 'Nodes.py', line 7354, in analyse_expressions: WhileStatNode(Parsing.py:98:4)
File 'Nodes.py', line 397, in analyse_expressions: StatListNode(Parsing.py:99:8)
File 'Nodes.py', line 6056, in analyse_expressions: SingleAssignmentNode(Parsing.py:99:34)
File 'Nodes.py', line 6189, in analyse_types: SingleAssignmentNode(Parsing.py:99:34)
File 'ExprNodes.py', line 6139, in analyse_types: SimpleCallNode(Parsing.py:99:34,
analysed = True,
result_is_used = True,
use_managed_ref = True)
File 'ExprNodes.py', line 6257, in analyse_c_function_call: SimpleCallNode(Parsing.py:99:34,
analysed = True,
result_is_used = True,
use_managed_ref = True)
File 'ExprNodes.py', line 2076, in coerce_to: NameNode(Parsing.py:99:35,
cf_state = [...]/1,
is_name = True,
name = 's',
result_is_used = True,
use_managed_ref = True)
File 'ExprNodes.py', line 983, in coerce_to: NameNode(Parsing.py:99:35,
cf_state = [...]/1,
is_name = True,
name = 's',
result_is_used = True,
use_managed_ref = True)
Compiler crash traceback from this point on:
File "/builddir/build/BUILD/Cython-3.0.11-build/cython-3.0.11/Cython/Compiler/ExprNodes.py", line 983, in coerce_to
if src_type.is_cv_qualified:
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'is_cv_qualified'
Compiling /builddir/build/BUILD/Cython-3.0.11-build/cython-3.0.11/Cython/Compiler/Parsing.py because it changed.
[1/1] Cythonizing /builddir/build/BUILD/Cython-3.0.11-build/cython-3.0.11/Cython/Compiler/Parsing.py
Traceback (most recent call last):
File "/usr/lib/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
~~~~^^
File "/usr/lib/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
metadata_directory)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.14/site-packages/setuptools/build_meta.py", line 410, in build_wheel
return self._build_with_temp_dir(
~~~~~~~~~~~~~~~~~~~~~~~~~^
['bdist_wheel'],
^^^^^^^^^^^^^^^^
...<3 lines>...
self._arbitrary_args(config_settings),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/lib/python3.14/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
self.run_setup()
~~~~~~~~~~~~~~^^
File "/usr/lib/python3.14/site-packages/setuptools/build_meta.py", line 487, in run_setup
super().run_setup(setup_script=setup_script)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.14/site-packages/setuptools/build_meta.py", line 311, in run_setup
exec(code, locals())
~~~~^^^^^^^^^^^^^^^^
File "<string>", line 319, in <module>
File "<string>", line 245, in run_build
File "/usr/lib/python3.14/site-packages/setuptools/__init__.py", line 104, in setup
return distutils.core.setup(**attrs)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
~~~~~~~~~~~~~~~~^^^^^
File "/usr/lib/python3.14/site-packages/setuptools/dist.py", line 967, in run_command
super().run_command(command)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
~~~~~~~~~~~^^
File "/usr/lib/python3.14/site-packages/wheel/bdist_wheel.py", line 368, in run
self.run_command("build")
~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib/python3.14/site-packages/setuptools/dist.py", line 967, in run_command
super().run_command(command)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
~~~~~~~~~~~^^
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/command/build.py", line 131, in run
self.run_command(cmd_name)
~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib/python3.14/site-packages/setuptools/dist.py", line 967, in run_command
super().run_command(command)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
~~~~~~~~~~~^^
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
self.build_extensions()
~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
self._build_extensions_serial()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3.14/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
self.build_extension(ext)
~~~~~~~~~~~~~~~~~~~~^^^^^
File "/builddir/build/BUILD/Cython-3.0.11-build/cython-3.0.11/Cython/Distutils/build_ext.py", line 130, in build_extension
new_ext = cythonize(
~~~~~~~~~^
ext,force=self.force, quiet=self.verbose == 0, **options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)[0]
^
File "/builddir/build/BUILD/Cython-3.0.11-build/cython-3.0.11/Cython/Build/Dependencies.py", line 1154, in cythonize
cythonize_one(*args)
~~~~~~~~~~~~~^^^^^^^
File "/builddir/build/BUILD/Cython-3.0.11-build/cython-3.0.11/Cython/Build/Dependencies.py", line 1321, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: /builddir/build/BUILD/Cython-3.0.11-build/cython-3.0.11/Cython/Compiler/Parsing.py
Building wheel for Cython (pyproject.toml): finished with status 'error'
Code to reproduce the behaviour:
No response
Expected behaviour
No response
OS
Fedora Linux
Python version
Python 3.14.0a1
Cython version
3.0.11
Additional context
Build happened in our test build system. Happy to test fixes.
Reactions are currently unavailable
Activity
hroncok commentedon Oct 18, 2024
I can reproduce this at cython master branch @ a2b9f55 (also with Python 3.14.0a1).
hroncok commentedon Oct 18, 2024
Actually, my error is a bit different, but I build it a bit differently:
scoder commentedon Oct 18, 2024
The crashes apparently happen while running Cython as pure Python code that translates a Python module in Cython itself. That suggests a bug in CPython rather than Cython. Recent work in CPython is strongly geared towards performance improvements, touching almost all parts of the implementation. While there is a certain chance that we're doing something special in Cython's Python code, I wouldn't be surprised to see further user code breakage in CPython, especially in an early alpha release. I still remember Victor's "break the world" move in Py3.13a1. This seems small in comparison.
hroncok commentedon Oct 18, 2024
See https://discuss.python.org/t/remove-again-private-apis-which-now-have-new-public-replacement/68081/1 about that for 3.14 (he's asking what to do so it's a chance to influence the course of action).
The "crash" seem to be this:
This does not sound like "interpreter crush" to me, but honestly this is a bit too magical for me :)
tacaswell commentedon Oct 18, 2024
I also see this with CPython main, I'm working on bisecting it.
tacaswell commentedon Oct 18, 2024
scoder commentedon Oct 18, 2024
That's a change in
ctypes, though. We don't use that anywhere. I don't see how that change could be related.tacaswell commentedon Oct 18, 2024
hmm, something went wrong with my bisect script as the log claims e256a7590a0149feadfef161ed000991376dc0e8 worked, but trying again does not...
tacaswell commentedon Oct 18, 2024
A second attempt (I think starting from 3.13 as the "good" version confused git with the branch)
However, this produces a slightly different error:
so I also worry that it has been broken/fixed a couple of times which is also making the bisect hard.
da-woods commentedon Oct 18, 2024
If I had to take a wild guess I'd think it might be something going wrong with
__hash__or__eq__for the contents of PyrexTypes.py. We were certainly caught be a change in the behaviour if you get an exception while evaluating__eq__in 3.13 (which I think was concluded to be "our fault") so it's possible that something similar might be happening again.That it a complete guess though, just based on the idea that we've seen something similar before and it does look like types aren't been found correctly.
scoder commentedon Oct 18, 2024
Yeah, the symptoms hint at something like
__hash__. Also that the error appears unstable – the hash variation across Python runs may well induce that. I'll try if settingPYTHONHASHSEEDmakes thebisectmore stable.EDIT: The concrete error varies in similar ways, so it's not simply that.
scoder commentedon Oct 18, 2024
I've reported the issue in the original CPython PR for now.
da-woods commentedon Oct 23, 2024
I've created the issue python/cpython#125868. Definitely a Python bug not a Cython bug - I get some very weird output from pdb.
tacaswell commentedon Nov 1, 2024
This is fixed on the current 3.13 branch.