Mark nogil functions as noexcept to avoid warning from newer cython (#15)

This commit is contained in:
KrisKennaway 2023-10-29 14:43:55 +00:00 committed by GitHub
parent 69a96b4719
commit f55e878b8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -4,12 +4,12 @@
# cython: wraparound=False
cdef inline float clip(float a, float min_value, float max_value) nogil:
cdef inline float clip(float a, float min_value, float max_value) noexcept nogil:
"""Clip a value between min_value and max_value inclusive."""
return min(max(a, min_value), max_value)
cdef inline float3 convert_rgb_to_cam16ucs(float[:, ::1] rgb_to_cam16ucs, float r, float g, float b) nogil:
cdef inline float3 convert_rgb_to_cam16ucs(float[:, ::1] rgb_to_cam16ucs, float r, float g, float b) noexcept nogil:
"""Converts floating point (r,g,b) valueto 3-tuple in CAM16UCS colour space, via 24-bit RGB lookup matrix."""
cdef unsigned int rgb_24bit = (<unsigned int>(r*255) << 16) + (<unsigned int>(g*255) << 8) + <unsigned int>(b*255)
@ -20,7 +20,7 @@ cdef inline float3 convert_rgb_to_cam16ucs(float[:, ::1] rgb_to_cam16ucs, float
return res
cdef inline float colour_distance_squared(float[3] colour1, float[3] colour2) nogil:
cdef inline float colour_distance_squared(float[3] colour1, float[3] colour2) noexcept nogil:
"""Computes Euclidean squared distance between two floating-point colour 3-tuples."""
return (

View File

@ -219,7 +219,7 @@ cdef int dither_lookahead(Dither* dither, unsigned char palette_depth, float[:,
# quant_error: RGB quantization error to be diffused
#
cdef inline void apply_one_line(Dither* dither, int xl, int xr, int x, float[] image, int image_shape1,
float[] quant_error) nogil:
float[] quant_error) noexcept nogil:
cdef int i, j
cdef float error_fraction
@ -241,7 +241,7 @@ cdef inline void apply_one_line(Dither* dither, int xl, int xr, int x, float[] i
# image: RGB pixel data, to be mutated
# quant_error: RGB quantization error to be diffused
#
cdef void apply(Dither* dither, int x_res, int y_res, int x, int y, float[:,:,::1] image, float[] quant_error) nogil:
cdef void apply(Dither* dither, int x_res, int y_res, int x, int y, float[:,:,::1] image, float[] quant_error) noexcept nogil:
cdef int i, j, k