Hello,
I am trying o make Cython 0.29.x work with Python 3.12.0a5+, so @hrnciar can continue testing Fedora packages with pre-releases of Python 3.12.
The idea is that once I make it work I'll contribute backports here and/or other interested folks contribute backports here and I'll test them in Fedora.
Note: We have considered upgrading to Cython 3.0.0b1 but far too many of our packages are not buildable with it (I've asked @hrnciar to provide a summary of the failures to you, in case you'd like that).
Following up on #5238 (comment) and 58d5fed61c I came up with this WIP patch for 0.29.33:
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index 33aac2c4a..b3de5dd75 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -210,6 +210,10 @@
#elif !defined(CYTHON_USE_PYLONG_INTERNALS)
#define CYTHON_USE_PYLONG_INTERNALS 1
#endif
+ #if PY_VERSION_HEX >= 0x030C00A5
+ #undef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 0
+ #endif
#ifndef CYTHON_USE_PYLIST_INTERNALS
#define CYTHON_USE_PYLIST_INTERNALS 1
#endif
@@ -252,7 +256,7 @@
#define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
#endif
#ifndef CYTHON_USE_DICT_VERSIONS
- #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
+ #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5))
#endif
#if PY_VERSION_HEX >= 0x030B00A4
#undef CYTHON_USE_EXC_INFO_STACK
This makes Cython at least build itself. However, the tests still fail.
Full logs: builder-live.log.gz
The test failures I could recognize are:
Exception hints
Expected:
Traceback (most recent call last):
...
AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__xxx__'
Got:
Traceback (most recent call last):
...
AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__xxx__'. Did you mean: '__yyy__'?
This looks like a test-expectation problem only and when I look at the master branch, I see that possibly the same failures would happen there as well.
Confirmed: This also happens with 3.0.0b1. Fixed in d883ccd
getattribute examples
Failed example:
g11 = object.__getattribute__(GetAttribute(), '__getattribute__')
Expected nothing
Got:
GetAttribute getattribute '__dict__'
GetAttribute getattribute '__class__'
GetAttribute getattribute '__dict__'
GetAttribute getattribute '__class__'
This also happens with 3.0.0b1.
Failed example:
(a.called_getattr, a.called_getattribute)
Expected:
(2, 11)
Got:
(6, 15)
This also happens with 3.0.0b1.
builtins.bool size changed (fixed in 3.0.0b1)
ERROR: runTest (__main__.CythonRunTestCase.runTest)
[0] compiling (cpp) and running type_inference
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/cython-0.29.33/runtests.py", line 1270, in run
self.run_tests(result, ext_so_path)
File "/builddir/build/BUILD/cython-0.29.33/runtests.py", line 1288, in run_tests
self.run_doctests(self.module, result, ext_so_path)
File "/builddir/build/BUILD/cython-0.29.33/runtests.py", line 1302, in run_doctests
run_forked_test(result, run_test, self.shortDescription(), self.fork)
File "/builddir/build/BUILD/cython-0.29.33/runtests.py", line 1307, in run_forked_test
run_func(result)
File "/builddir/build/BUILD/cython-0.29.33/runtests.py", line 1294, in run_test
module = import_ext(module_or_name, ext_so_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/cython-0.29.33/runtests.py", line 502, in import_ext
return imp.load_dynamic(module_name, file_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/imp.py", line 343, in load_dynamic
return _load(spec)
^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 872, in _load
File "<frozen importlib._bootstrap>", line 841, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1314, in exec_module
File "<frozen importlib._bootstrap>", line 400, in _call_with_frames_removed
File "tests/run/type_inference.pyx", line 1, in init type_inference (type_inference.cpp:27226)
# cython: infer_types = True
ValueError: builtins.bool size changed, may indicate binary incompatibility. Expected 32 from C header, got 24 from PyObject
This is only happening with 0.29.x.
Backported in 43ce558
undefined symbols
ImportError: /builddir/build/BUILD/cython-0.29.33/TEST_TMP/1/run/c/py_unicode_strings/py_unicode_strings.cpython-312-x86_64-linux-gnu.so: undefined symbol: PyUnicode_FromUnicode
It's only used if you use the old Py_UNICODE type explicitly in your code. We disable the respective tests on CPython versions that no longer support it (without deprecation warnings).
We need to backport runtest.py changes from 9d38bf8 / #5154
Hello,
I am trying o make Cython 0.29.x work with Python 3.12.0a5+, so @hrnciar can continue testing Fedora packages with pre-releases of Python 3.12.
The idea is that once I make it work I'll contribute backports here and/or other interested folks contribute backports here and I'll test them in Fedora.
Note: We have considered upgrading to Cython 3.0.0b1 but far too many of our packages are not buildable with it (I've asked @hrnciar to provide a summary of the failures to you, in case you'd like that).
Following up on #5238 (comment) and 58d5fed61c I came up with this WIP patch for 0.29.33:
This makes Cython at least build itself. However, the tests still fail.
Full logs: builder-live.log.gz
The test failures I could recognize are:
Exception hints
This looks like a test-expectation problem only and when I look at the master branch, I see that possibly the same failures would happen there as well.
Confirmed: This also happens with 3.0.0b1. Fixed in d883ccd
getattribute examples
This also happens with 3.0.0b1.
This also happens with 3.0.0b1.
builtins.bool size changed (fixed in 3.0.0b1)
This is only happening with 0.29.x.
Backported in 43ce558
undefined symbols
We need to backport runtest.py changes from 9d38bf8 / #5154