Skip to content

Commit

Permalink
Cython 3.0.0b1 compatibility fix
Browse files Browse the repository at this point in the history
apply by default and revert the change if we find an old version of Cython
  • Loading branch information
totaam committed Feb 27, 2023
1 parent 7e66fb9 commit 9b4d2e6
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 4 deletions.
5 changes: 5 additions & 0 deletions packaging/debian/xpra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ MATCH=`find $REPO_ARCH_PATH/ -name "${DEB_FILENAME}" | wc -l`
if [ "$MATCH" != "0" ]; then
echo "package already exists"
else
#do we need to patch for older versions of Cython?
CM=`python3 -c "import cython;print(cython.__version__.split('.')[0])"`
if [ "${CM}" == "2" ]; then
echo "cython2.patch" >> packaging/debian/xpra/patches/series
fi
if [ `arch` == "aarch64" ]; then
debuild --no-lintian -us -uc -b
else
Expand Down
46 changes: 46 additions & 0 deletions packaging/debian/xpra/patches/cython2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git b/xpra/codecs/enc_ffmpeg/encoder.pyx a/xpra/codecs/enc_ffmpeg/encoder.pyx
index b499dd9b0..b8e914bf2 100644
--- b/xpra/codecs/enc_ffmpeg/encoder.pyx
+++ a/xpra/codecs/enc_ffmpeg/encoder.pyx
@@ -1161,7 +1161,7 @@ cdef list_options(void *obj, const AVClass *av_class, int skip=1):
list_options(child, child_class, skip-1)


-cdef int write_packet(void *opaque, uint8_t *buf, int buf_size) noexcept:
+cdef int write_packet(void *opaque, uint8_t *buf, int buf_size):
global GEN_TO_ENCODER
encoder = GEN_TO_ENCODER.get(<uintptr_t> opaque)
#log.warn("write_packet(%#x, %#x, %#x) encoder=%s", <uintptr_t> opaque, <uintptr_t> buf, buf_size, type(encoder))
diff --git b/xpra/x11/bindings/xwait.pyx a/xpra/x11/bindings/xwait.pyx
index f1613c16f..df5dcfefc 100644
--- b/xpra/x11/bindings/xwait.pyx
+++ a/xpra/x11/bindings/xwait.pyx
@@ -33,13 +33,13 @@ cdef end(msg, int code = exit_code):
exit_event.set()


-cdef int x11_io_error_handler(Display *display) noexcept:
+cdef int x11_io_error_handler(Display *display):
global message
message = b"X11 fatal IO error"
exit_code = 0
return 0

-cdef int x11_error_handler(Display *display, XErrorEvent *event) noexcept:
+cdef int x11_error_handler(Display *display, XErrorEvent *event):
#X11 error handler called (ignored)
return 0

diff --git b/xpra/x11/gtk3/gdk_bindings.pyx a/xpra/x11/gtk3/gdk_bindings.pyx
index dc887cc20..110cac70f 100644
--- b/xpra/x11/gtk3/gdk_bindings.pyx
+++ a/xpra/x11/gtk3/gdk_bindings.pyx
@@ -837,7 +837,7 @@ cdef object _gw(display, Window xwin):

cdef GdkFilterReturn x_event_filter(GdkXEvent * e_gdk,
GdkEvent * gdk_event,
- void * userdata) noexcept with gil:
+ void * userdata) with gil:
cdef object event_args
cdef object pyev
cdef double start = monotonic()
2 changes: 1 addition & 1 deletion xpra/codecs/enc_ffmpeg/encoder.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ cdef list_options(void *obj, const AVClass *av_class, int skip=1):
list_options(child, child_class, skip-1)


cdef int write_packet(void *opaque, uint8_t *buf, int buf_size):
cdef int write_packet(void *opaque, uint8_t *buf, int buf_size) noexcept:
global GEN_TO_ENCODER
encoder = GEN_TO_ENCODER.get(<uintptr_t> opaque)
#log.warn("write_packet(%#x, %#x, %#x) encoder=%s", <uintptr_t> opaque, <uintptr_t> buf, buf_size, type(encoder))
Expand Down
4 changes: 2 additions & 2 deletions xpra/x11/bindings/xwait.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ cdef end(msg, int code = exit_code):
exit_event.set()


cdef int x11_io_error_handler(Display *display):
cdef int x11_io_error_handler(Display *display) noexcept:
global message
message = b"X11 fatal IO error"
exit_code = 0
return 0

cdef int x11_error_handler(Display *display, XErrorEvent *event):
cdef int x11_error_handler(Display *display, XErrorEvent *event) noexcept:
#X11 error handler called (ignored)
return 0

Expand Down
2 changes: 1 addition & 1 deletion xpra/x11/gtk3/gdk_bindings.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ cdef object _gw(display, Window xwin):

cdef GdkFilterReturn x_event_filter(GdkXEvent * e_gdk,
GdkEvent * gdk_event,
void * userdata) with gil:
void * userdata) noexcept with gil:
cdef object event_args
cdef object pyev
cdef double start = monotonic()
Expand Down

0 comments on commit 9b4d2e6

Please sign in to comment.