Actions
Bug #62140
closedpybind/rbd/rbd.pyx does not build with Cython-3
% Done:
0%
Source:
Community (dev)
Tags:
backport_processed
Backport:
reef
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Description
Fedora rawhide (a.k.a. f39) has updated Cython to Cython-3 (from Cython-0.29)
Builds now fail with the following errors:
... cd /builddir/build/BUILD/ceph-18.1.2/src/pybind/rbd && env CC="/usr/bin/gcc" CFLAGS="" CPPFLAGS="-iquote/builddir/build/BUILD/ceph-18.1.2/src/include -w -D'void0=dead_function(void)' -D'__Pyx_check_single_interpreter(ARG)=ARG##0'" CXX="/usr/bin/g++" LDSHARED="/usr/bin/gcc -shared" OPT="-DNDEBUG -g -fwrapv -O2 -w" LDFLAGS=-L/builddir/build/BUILD/ceph-18.1.2/redhat-linux-build/lib CYTHON_BUILD_DIR=/builddir/build/BUILD/ceph-18.1.2/redhat-linux-build/src/pybind/rbd CEPH_LIBDIR=/builddir/build/BUILD/ceph-18.1.2/redhat-linux-build/lib /usr/bin/python3.12 /builddir/build/BUILD/ceph-18.1.2/src/pybind/rbd/setup.py build --build-base /builddir/build/BUILD/ceph-18.1.2/redhat-linux-build/lib/cython_modules --build-platlib /builddir/build/BUILD/ceph-18.1.2/redhat-linux-build/lib/cython_modules/lib.3 /builddir/build/BUILD/ceph-18.1.2/src/pybind/rbd/setup.py:8: DeprecationWarning: 'pkgutil.find_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec() instead if not pkgutil.find_loader('setuptools'): warning: rbd.pyx:36:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 warning: rbd.pyx:361:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 warning: c_rbd.pxd:596:48: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython. warning: ../rados/rados.pxd:7:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 Error compiling Cython file: ------------------------------------------------------------ ... """ name = cstr(name, 'name') cdef: rados_ioctx_t _ioctx = convert_ioctx(ioctx) char *_name = name librbd_progress_fn_t _prog_cb = &no_op_progress_callback ^ ------------------------------------------------------------ rbd.pyx:760:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... rados_ioctx_t _ioctx = convert_ioctx(ioctx) char *_name = name librbd_progress_fn_t _prog_cb = &no_op_progress_callback void *_prog_arg = NULL if on_progress: _prog_cb = &progress_callback ^ ------------------------------------------------------------ rbd.pyx:763:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... image_id = cstr(image_id, 'image_id') cdef: rados_ioctx_t _ioctx = convert_ioctx(ioctx) char *_image_id = image_id int _force = force librbd_progress_fn_t _prog_cb = &no_op_progress_callback ^ ------------------------------------------------------------ rbd.pyx:868:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... char *_image_id = image_id int _force = force librbd_progress_fn_t _prog_cb = &no_op_progress_callback void *_prog_arg = NULL if on_progress: _prog_cb = &progress_callback ^ ------------------------------------------------------------ rbd.pyx:871:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... """ image_name = cstr(image_name, 'image_name') cdef: rados_ioctx_t _ioctx = convert_ioctx(ioctx) char *_image_name = image_name librbd_progress_fn_t _prog_cb = &no_op_progress_callback ^ ------------------------------------------------------------ rbd.pyx:1097:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... rados_ioctx_t _ioctx = convert_ioctx(ioctx) char *_image_name = image_name librbd_progress_fn_t _prog_cb = &no_op_progress_callback void *_prog_arg = NULL if on_progress: _prog_cb = &progress_callback ^ ------------------------------------------------------------ rbd.pyx:1100:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... """ image_name = cstr(image_name, 'image_name') cdef: rados_ioctx_t _ioctx = convert_ioctx(ioctx) char *_image_name = image_name librbd_progress_fn_t _prog_cb = &no_op_progress_callback ^ ------------------------------------------------------------ rbd.pyx:1124:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... rados_ioctx_t _ioctx = convert_ioctx(ioctx) char *_image_name = image_name librbd_progress_fn_t _prog_cb = &no_op_progress_callback void *_prog_arg = NULL if on_progress: _prog_cb = &progress_callback ^ ------------------------------------------------------------ rbd.pyx:1127:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... """ image_name = cstr(image_name, 'image_name') cdef: rados_ioctx_t _ioctx = convert_ioctx(ioctx) char *_image_name = image_name librbd_progress_fn_t _prog_cb = &no_op_progress_callback ^ ------------------------------------------------------------ rbd.pyx:1151:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... rados_ioctx_t _ioctx = convert_ioctx(ioctx) char *_image_name = image_name librbd_progress_fn_t _prog_cb = &no_op_progress_callback void *_prog_arg = NULL if on_progress: _prog_cb = &progress_callback ^ ------------------------------------------------------------ rbd.pyx:1154:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... cdef: rbd_completion_t completion PyObject* p_completion_obj= <PyObject*>completion_obj with nogil: ret = rbd_aio_create_completion(p_completion_obj, __aio_complete_cb, ^ ------------------------------------------------------------ rbd.pyx:2927:62: Cannot assign type 'void (rbd_completion_t, void *) except * nogil' to 'rbd_callback_t' Error compiling Cython file: ------------------------------------------------------------ ... if not allow_shrink and old_size > size: raise InvalidArgument("error allow_shrink is False but old_size > new_size") cdef: uint64_t _size = size bint _allow_shrink = allow_shrink librbd_progress_fn_t prog_cb = &no_op_progress_callback ^ ------------------------------------------------------------ rbd.pyx:3007:43: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... """ name = cstr(name, 'name') cdef: char *_name = name uint32_t _flags = flags librbd_progress_fn_t prog_cb = &no_op_progress_callback ^ ------------------------------------------------------------ rbd.pyx:3511:43: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... name = cstr(name, 'name') cdef: char *_name = name uint32_t _flags = flags librbd_progress_fn_t prog_cb = &no_op_progress_callback ^ ------------------------------------------------------------ rbd.pyx:3570:43: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... Flatten clone image (copy all blocks from parent to child) :param on_progress: optional progress callback function :type on_progress: callback function """ cdef: librbd_progress_fn_t _prog_cb = &no_op_progress_callback ^ ------------------------------------------------------------ rbd.pyx:4085:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... """ cdef: librbd_progress_fn_t _prog_cb = &no_op_progress_callback void *_prog_arg = NULL if on_progress: _prog_cb = &progress_callback ^ ------------------------------------------------------------ rbd.pyx:4088:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Error compiling Cython file: ------------------------------------------------------------ ... @requires_not_closed def rebuild_object_map(self): """ Rebuild the object map for the image HEAD or currently set snapshot """ cdef librbd_progress_fn_t prog_cb = &no_op_progress_callback ^ ------------------------------------------------------------ rbd.pyx:4112:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t' Compiling rbd.pyx because it changed. [1/1] Cythonizing rbd.pyx Traceback (most recent call last): File "/builddir/build/BUILD/ceph-18.1.2/src/pybind/rbd/setup.py", line 192, in <module> ext_modules=cythonize( ^^^^^^^^^^ File "/usr/lib64/python3.12/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize cythonize_one(*args) File "/usr/lib64/python3.12/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one raise CompileError(None, pyx_file) Cython.Compiler.Errors.CompileError: rbd.pyx ...
full log at https://kojipkgs.fedoraproject.org//work/tasks/4604/103744604/build.log for a limited amount of time. Note the warnings too.
I used the following patch:
--- ceph-18.1.2/src/pybind/rbd/rbd.pyx.orig 2023-07-21 13:30:08.156825317 -0400
+++ ceph-18.1.2/src/pybind/rbd/rbd.pyx 2023-07-24 09:09:27.930137117 -0400
@@ -371,10 +371,10 @@
cdef rados_ioctx_t convert_ioctx(rados.Ioctx ioctx) except? NULL:
return <rados_ioctx_t>ioctx.io
-cdef int progress_callback(uint64_t offset, uint64_t total, void* ptr) with gil:
+cdef int progress_callback(uint64_t offset, uint64_t total, void* ptr) noexcept with gil:
return (<object>ptr)(offset, total)
-cdef int no_op_progress_callback(uint64_t offset, uint64_t total, void* ptr):
+cdef int no_op_progress_callback(uint64_t offset, uint64_t total, void* ptr) noexcept with gil:
return 0
def cstr(val, name, encoding="utf-8", opt=False):
@@ -426,7 +426,7 @@
cdef class Completion
-cdef void __aio_complete_cb(rbd_completion_t completion, void *args) with gil:
+cdef void __aio_complete_cb(rbd_completion_t completion, void *args) noexcept with gil:
"""
Callback to oncomplete() for asynchronous operations
"""
Actions