From 26f99e1a9e69529b6d4c2ea25b0b5aaa25ec4051 Mon Sep 17 00:00:00 2001 From: "Prof. Dr. Andreas Noack" Date: Tue, 26 Sep 2023 11:42:02 +0200 Subject: [PATCH] Add noexcept to fix compiling of cythonext (#1065) --- src/urh/dev/native/lib/airspy.pyx | 2 +- src/urh/dev/native/lib/hackrf.pyx | 4 ++-- src/urh/dev/native/lib/rtlsdr.pyx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/urh/dev/native/lib/airspy.pyx b/src/urh/dev/native/lib/airspy.pyx index 080b036e37..ee2cf43f41 100644 --- a/src/urh/dev/native/lib/airspy.pyx +++ b/src/urh/dev/native/lib/airspy.pyx @@ -17,7 +17,7 @@ ctypedef unsigned long long uint64_t cdef cairspy.airspy_device* _c_device cdef object f -cdef int _c_callback_recv(cairspy.airspy_transfer*transfer) with gil: +cdef int _c_callback_recv(cairspy.airspy_transfer*transfer) noexcept with gil: global f try: ( f)(transfer.samples) diff --git a/src/urh/dev/native/lib/hackrf.pyx b/src/urh/dev/native/lib/hackrf.pyx index 5dad224560..dbe4f9a748 100644 --- a/src/urh/dev/native/lib/hackrf.pyx +++ b/src/urh/dev/native/lib/hackrf.pyx @@ -10,7 +10,7 @@ TIMEOUT = 0.2 cdef object f cdef int RUNNING = 0 -cdef int _c_callback_recv(chackrf.hackrf_transfer*transfer) with gil: +cdef int _c_callback_recv(chackrf.hackrf_transfer*transfer) noexcept with gil: global f, RUNNING try: ( f)(transfer.buffer[0:transfer.valid_length]) @@ -19,7 +19,7 @@ cdef int _c_callback_recv(chackrf.hackrf_transfer*transfer) with gil: logger.error("Cython-HackRF:" + str(e)) return -1 -cdef int _c_callback_send(chackrf.hackrf_transfer*transfer) with gil: +cdef int _c_callback_send(chackrf.hackrf_transfer*transfer) noexcept with gil: global f, RUNNING # tostring() is a compatibility (numpy<1.9) alias for tobytes(). Despite its name it returns bytes not strings. cdef unsigned int i diff --git a/src/urh/dev/native/lib/rtlsdr.pyx b/src/urh/dev/native/lib/rtlsdr.pyx index c1ea1ad464..065300d9d6 100644 --- a/src/urh/dev/native/lib/rtlsdr.pyx +++ b/src/urh/dev/native/lib/rtlsdr.pyx @@ -8,7 +8,7 @@ ctypedef unsigned long long uint64_t cdef crtlsdr.rtlsdr_dev_t*_c_device -cdef void _c_callback_recv(unsigned char *buffer, uint32_t length, void *ctx): +cdef void _c_callback_recv(unsigned char *buffer, uint32_t length, void *ctx) noexcept: global f conn = ctx (f)(buffer[0:length]) @@ -339,4 +339,4 @@ cpdef int set_bias_tee(int on): return -1 if device is not initialized. 0 otherwise. """ - return crtlsdr.rtlsdr_set_bias_tee (_c_device, on) \ No newline at end of file + return crtlsdr.rtlsdr_set_bias_tee (_c_device, on)