[BUG] [HEADS UP] Cython build failure with Python 3.14.0a1
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.
I can reproduce this at cython master branch @ a2b9f55670b765d9b482fd7d8533f2df914e7387 (also with Python 3.14.0a1).
Actually, my error is a bit different, but I build it a bit differently:
[1/1] Cythonizing .../cython/Cython/Compiler/Parsing.py
warning: Cython/Compiler/Parsing.py:100:0: noexcept clause is ignored for function returning Python object
warning: Cython/Compiler/Parsing.py:197:0: noexcept clause is ignored for function returning Python object
Error compiling Cython file:
------------------------------------------------------------
...
@cython.ccall
def make_slice_node(pos, start, stop = None, step = None):
if not start:
start = ExprNodes.NoneNode(pos)
^
------------------------------------------------------------
Cython/Compiler/Parsing.py:750:34: Compiler crash in AnalyseExpressionsTransform
ModuleNode.body = StatListNode(Parsing.py:8:0)
StatListNode.stats[65] = StatListNode(Parsing.py:747:0)
StatListNode.stats[0] = CompilerDirectivesNode(Parsing.py:747:0)
CompilerDirectivesNode.body = StatListNode(Parsing.py:747:0)
StatListNode.stats[0] = CFuncDefNode(Parsing.py:747:0,
args = [...]/4,
modifiers = [...]/0,
outer_attrs = [...]/2,
overridable = True,
visibility = 'private')
File 'Nodes.py', line 400, in analyse_expressions: StatListNode(Parsing.py:749:4,
is_terminator = True)
File 'Nodes.py', line 344, in analyse_expressions: CompilerDirectivesNode(Parsing.py:749:4,
is_terminator = True)
File 'Nodes.py', line 400, in analyse_expressions: StatListNode(Parsing.py:749:4,
is_terminator = True)
File 'Nodes.py', line 7250, in analyse_expressions: IfStatNode(Parsing.py:749:4)
File 'Nodes.py', line 7297, in analyse_expressions: IfClauseNode(Parsing.py:749:7)
File 'Nodes.py', line 400, in analyse_expressions: StatListNode(Parsing.py:750:34)
File 'Nodes.py', line 6133, in analyse_expressions: SingleAssignmentNode(Parsing.py:750:34)
File 'Nodes.py', line 6266, in analyse_types: SingleAssignmentNode(Parsing.py:750:34)
File 'ExprNodes.py', line 6124, in analyse_types: SimpleCallNode(Parsing.py:750:34,
analysed = True,
result_is_used = True,
use_managed_ref = True)
File 'ExprNodes.py', line 8643, in analyse_types: TupleNode(Parsing.py:750:34,
is_sequence_constructor = 1,
result_is_used = True,
use_managed_ref = True)
Compiler crash traceback from this point on:
File ".../cython/Cython/Compiler/ExprNodes.py", line 8643, in analyse_types
if len(self.args) == 0:
~~~^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
Traceback (most recent call last):
File ".../cython/setup.py", line 356, in <module>
run_build()
~~~~~~~~~^^
File ".../cython/setup.py", line 278, in run_build
setup(
~~~~~^
name='Cython',
^^^^^^^^^^^^^^
...<71 lines>...
**setup_args
^^^^^^^^^^^^
)
^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/__init__.py", line 117, in setup
return distutils.core.setup(**attrs)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/_distutils/core.py", line 183, in setup
return run_commands(dist)
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/_distutils/core.py", line 199, in run_commands
dist.run_commands()
~~~~~~~~~~~~~~~~~^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
self.run_command(cmd)
~~~~~~~~~~~~~~~~^^^^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/dist.py", line 991, in run_command
super().run_command(command)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
cmd_obj.run()
~~~~~~~~~~~^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/_distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
~~~~~~~~~~~~~~~~^^^^^^^^^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
self.distribution.run_command(command)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/dist.py", line 991, in run_command
super().run_command(command)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
cmd_obj.run()
~~~~~~~~~~~^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/command/build_ext.py", line 98, in run
_build_ext.run(self)
~~~~~~~~~~~~~~^^^^^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
self.build_extensions()
~~~~~~~~~~~~~~~~~~~~~^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/_distutils/command/build_ext.py", line 476, in build_extensions
self._build_extensions_serial()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/_distutils/command/build_ext.py", line 502, in _build_extensions_serial
self.build_extension(ext)
~~~~~~~~~~~~~~~~~~~~^^^^^
File ".../cython/venv/lib64/python3.14/site-packages/setuptools/command/build_ext.py", line 263, in build_extension
_build_ext.build_extension(self, ext)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File ".../cython/Cython/Distutils/build_ext.py", line 129, in build_extension
new_ext = cythonize(
~~~~~~~~~^
ext,force=self.force, quiet=self.verbose == 0, **options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)[0]
^
File ".../cython/Cython/Build/Dependencies.py", line 1109, in cythonize
cythonize_one(*args)
~~~~~~~~~~~~~^^^^^^^
File ".../cython/Cython/Build/Dependencies.py", line 1256, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: .../cython/Cython/Compiler/Parsing.py
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.
I still remember Victor's "break the world" move in Py3.13a1.
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:
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'
Compiler crash traceback from this point on:
File ".../cython/Cython/Compiler/ExprNodes.py", line 8643, in analyse_types
if len(self.args) == 0:
~~~^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
This does not sound like "interpreter crush" to me, but honestly this is a bit too magical for me :)
I also see this with CPython main, I'm working on bisecting it.
@ git bisect log
# bad: [2e950e341930ea79549137d4d3771d5edb940e65] Add tests for time.strftime() with invalid format string (GH-125696)
# good: [8204014280fcb07c9321305a729716326e625c6e] [3.13] Add tests for time.strftime() with invalid format string (GH-125696) (GH-125702)
git bisect start 'main' '3.13'
# good: [2268289a47c6e3c9a220b53697f9480ec390466f] Python 3.13.0b1
git bisect good 2268289a47c6e3c9a220b53697f9480ec390466f
# good: [d52726ccd456833ea9f09cabb4b8aef09755e472] Document ``mimetypes.MimeTypes.add_type()`` (#122301)
git bisect good d52726ccd456833ea9f09cabb4b8aef09755e472
# good: [aba42c0b547e6395c9c268cf98a298d0494cb9df] gh-123969: refactor _PyErr_RaiseSyntaxError and _PyErr_EmitSyntaxWarning out of compiler (#123972)
git bisect good aba42c0b547e6395c9c268cf98a298d0494cb9df
# bad: [1d4e3e0585c1051ec182666668137fbb0fc1a4d2] gh-111178: Fix locale_free() signature (#124896)
git bisect bad 1d4e3e0585c1051ec182666668137fbb0fc1a4d2
# bad: [909c6f718913e713c990d69e6d8a74c05f81e2c2] gh-123884 Tee of tee was not producing n independent iterators (gh-124490)
git bisect bad 909c6f718913e713c990d69e6d8a74c05f81e2c2
# good: [c87b0e4a462f98c418f750c6c95d4d8715c38332] GH-124284: Add stats for refcount operations on immortal objects (GH-124288)
git bisect good c87b0e4a462f98c418f750c6c95d4d8715c38332
# bad: [4a5e4aade420c594c5b3fe0589e9e6b444bd6ee5] gh-59317: Improve parsing optional positional arguments in argparse (GH-124303)
git bisect bad 4a5e4aade420c594c5b3fe0589e9e6b444bd6ee5
# good: [38a887dc3ec52c4a7222279bf4b3ca2431b86de9] gh-119004: fix a crash in equality testing between `OrderedDict` (#121329)
git bisect good 38a887dc3ec52c4a7222279bf4b3ca2431b86de9
# bad: [9d344fafc4385cb2e17425b77b54660ca83c61ac] gh-124127: Make Py_REFCNT() opaque in limited C API 3.14 (#124128)
git bisect bad 9d344fafc4385cb2e17425b77b54660ca83c61ac
# bad: [d87482bc4ee9458d6ba16140e7bc008637dbbb16] gh-119333: Add C api to have contextvar enter/exit callbacks (#119335)
git bisect bad d87482bc4ee9458d6ba16140e7bc008637dbbb16
# bad: [be76e3f26e0b907f711497d006b8b83bff04c036] gh-100980: ctypes: Test, document, and fix finalizing _fields_ (GH-124292)
git bisect bad be76e3f26e0b907f711497d006b8b83bff04c036
# good: [e256a7590a0149feadfef161ed000991376dc0e8] Lint and format Tools/build/check-warnings.py (#124382)
git bisect good e256a7590a0149feadfef161ed000991376dc0e8
# first bad commit: [be76e3f26e0b907f711497d006b8b83bff04c036] gh-100980: ctypes: Test, document, and fix finalizing _fields_ (GH-124292)
via https://github.com/python/cpython/pull/124292
(git bisect run ... is super usful!)
That's a change in ctypes, though. We don't use that anywhere. I don't see how that change could be related.
hmm, something went wrong with my bisect script as the log claims e256a7590a0149feadfef161ed000991376dc0e8 worked, but trying again does not...
A second attempt (I think starting from 3.13 as the "good" version confused git with the branch)
@ git bisect log
git bisect start
# status: waiting for both good and bad commits
# good: [5a1205b641df133932ed4c65b9a4ff5724e89963] gh-111499: Fix PYTHONMALLOCSTATS at Python exit (#120021)
git bisect good 5a1205b641df133932ed4c65b9a4ff5724e89963
# status: waiting for bad commit, 1 good commit known
# bad: [2e950e341930ea79549137d4d3771d5edb940e65] Add tests for time.strftime() with invalid format string (GH-125696)
git bisect bad 2e950e341930ea79549137d4d3771d5edb940e65
# bad: [7b8328b6b33939dfff4606d286b10069a09223dd] GH-121723: Skip test_config_queue_handler_multiprocessing_context in emulated JIT CI (#122969)
git bisect bad 7b8328b6b33939dfff4606d286b10069a09223dd
# good: [59be79ae60073f7b6bdf6ce921560c279937e4ab] gh-108297: Update crashers README for test_crashers removal (#121475)
git bisect good 59be79ae60073f7b6bdf6ce921560c279937e4ab
# good: [bb108580dec5d8655ccdfb6c8737b5f64e3366d0] gh-122087: Add tests for ismethoddescriptor() and isroutine() with partial objects (GH-122219)
git bisect good bb108580dec5d8655ccdfb6c8737b5f64e3366d0
# good: [06eb9701a182b4720dfa8766cb41cc5a3728a8b9] Doc: Grammar fix in ``library/ssl.rst``, 'Verifying certificates' (#122646)
git bisect good 06eb9701a182b4720dfa8766cb41cc5a3728a8b9
# bad: [57d7c3e78fb635a0c6ccce38ec3e2f4284d5fac7] gh-122247: Move instruction instrumentation sanity check after tracing check (#122251)
git bisect bad 57d7c3e78fb635a0c6ccce38ec3e2f4284d5fac7
# bad: [4b66b6b7d6e65f9eb2d61435b9b37ffeb7bb00fb] gh-120104: IDLE: Fix padding in config and search dialogs (#120107)
git bisect bad 4b66b6b7d6e65f9eb2d61435b9b37ffeb7bb00fb
# bad: [44659d392751f0161a0f958fec39ad013da45427] GH-118943: Handle races when moving jit_stencils.h (GH-120690)
git bisect bad 44659d392751f0161a0f958fec39ad013da45427
# good: [f5c39b3e9cc88d1eaa9229d610b0221305a83ad9] gh-122661: Remove GNU make-specific directive from Doc/Makefile (#122662)
git bisect good f5c39b3e9cc88d1eaa9229d610b0221305a83ad9
# good: [5207adf228547273b0e8d0253c23c69b95d7fe11] build(deps-dev): bump mypy from 1.10.1 to 1.11.1 in /Tools (#122550)
git bisect good 5207adf228547273b0e8d0253c23c69b95d7fe11
# good: [1bb955a2fe0237721c141fdfe520fd3ba46db11e] gh-122459: Optimize pickling by name objects without __module__ (GH-122460)
git bisect good 1bb955a2fe0237721c141fdfe520fd3ba46db11e
# bad: [5bd72912a1a85be96092de302608a4298741c6cd] GH-122616: Simplify LOAD_ATTR_WITH_HINT and STORE_ATTR_WITH_HINT (GH-122620)
git bisect bad 5bd72912a1a85be96092de302608a4298741c6cd
# first bad commit: [5bd72912a1a85be96092de302608a4298741c6cd] GH-122616: Simplify LOAD_ATTR_WITH_HINT and STORE_ATTR_WITH_HINT (GH-122620)
However, this produces a slightly different error:
[1/1] Cythonizing /home/tcaswell/source/p/cython/cython/Cython/Compiler/Parsing.py
warning: Cython/Compiler/Parsing.py:100:0: noexcept clause is ignored for function returning Python object
warning: Cython/Compiler/Parsing.py:197:0: noexcept clause is ignored for function returning Python object
Error compiling Cython file:
------------------------------------------------------------
...
if ctx.api:
s.error("'api' not allowed with this statement", fatal=False)
elif s.sy == 'def':
# def statements aren't allowed in pxd files, except
# as part of a cdef class
if ('pxd' in ctx.level) and (ctx.level != 'c_class_pxd'):
^
------------------------------------------------------------
Cython/Compiler/Parsing.py:2598:22: Compiler crash in AnalyseExpressionsTransform
ModuleNode.body = StatListNode(Parsing.py:8:0)
StatListNode.stats[138] = StatListNode(Parsing.py:2530:0)
StatListNode.stats[0] = CompilerDirectivesNode(Parsing.py:2530:0)
CompilerDirectivesNode.body = StatListNode(Parsing.py:2530:0)
StatListNode.stats[0] = CFuncDefNode(Parsing.py:2530:0,
args = [...]/3,
modifiers = [...]/0,
outer_attrs = [...]/2,
visibility = 'private')
File 'Nodes.py', line 400, in analyse_expressions: StatListNode(Parsing.py:2532:4)
File 'Nodes.py', line 344, in analyse_expressions: CompilerDirectivesNode(Parsing.py:2532:4)
File 'Nodes.py', line 400, in analyse_expressions: StatListNode(Parsing.py:2532:4)
File 'Nodes.py', line 7252, in analyse_expressions: IfStatNode(Parsing.py:2579:4)
File 'Nodes.py', line 400, in analyse_expressions: StatListNode(Parsing.py:2593:8)
File 'Nodes.py', line 7250, in analyse_expressions: IfStatNode(Parsing.py:2593:8)
File 'Nodes.py', line 7297, in analyse_expressions: IfClauseNode(Parsing.py:2595:13,
is_terminator = True)
File 'Nodes.py', line 400, in analyse_expressions: StatListNode(Parsing.py:2598:12,
is_terminator = True)
File 'Nodes.py', line 7250, in analyse_expressions: IfStatNode(Parsing.py:2598:12)
File 'Nodes.py', line 7296, in analyse_expressions: IfClauseNode(Parsing.py:2598:15)
File 'ExprNodes.py', line 644, in analyse_temp_boolean_expression: BoolBinopNode(Parsing.py:2598:36,
is_temp = True,
operator = 'and',
result_is_used = True,
use_managed_ref = True)
File 'ExprNodes.py', line 12937, in analyse_types: BoolBinopNode(Parsing.py:2598:36,
is_temp = True,
operator = 'and',
result_is_used = True,
use_managed_ref = True)
File 'ExprNodes.py', line 13718, in analyse_types: PrimaryCmpNode(Parsing.py:2598:22,
operator = 'in',
result_is_used = True,
use_managed_ref = True)
File 'ExprNodes.py', line 13476, in is_ptr_contains: PrimaryCmpNode(Parsing.py:2598:22,
operator = 'in',
result_is_used = True,
use_managed_ref = True)
Compiler crash traceback from this point on:
File "/home/tcaswell/source/p/cython/cython/Cython/Compiler/ExprNodes.py", line 13476, in is_ptr_contains
return (container_type.is_ptr or container_type.is_array) \
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'is_ptr'
so I also worry that it has been broken/fixed a couple of times which is also making the bisect hard.
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.
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 setting PYTHONHASHSEED makes the bisect more stable.
EDIT: The concrete error varies in similar ways, so it's not simply that.
I've reported the issue in the original CPython PR for now.
I've created the issue https://github.com/python/cpython/issues/125868. Definitely a Python bug not a Cython bug - I get some very weird output from pdb.
This is fixed on the current 3.13 branch.