Skip to content

Commit

Permalink
Add noexcept to fix compiling of cythonext (#1065)
Browse files Browse the repository at this point in the history
  • Loading branch information
andynoack authored Sep 26, 2023
1 parent 6484625 commit 26f99e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/urh/dev/native/lib/airspy.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
(<object> f)(<float [:2*transfer.sample_count]>transfer.samples)
Expand Down
4 changes: 2 additions & 2 deletions src/urh/dev/native/lib/hackrf.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
(<object> f)(transfer.buffer[0:transfer.valid_length])
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/urh/dev/native/lib/rtlsdr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <object> ctx
(<object>f)(buffer[0:length])
Expand Down Expand Up @@ -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)
return crtlsdr.rtlsdr_set_bias_tee (_c_device, on)

0 comments on commit 26f99e1

Please sign in to comment.