Skip to content

Commit a345db6

Browse files
jakirkhamdstansbypre-commit-ci[bot]
authored
Add noexcept to _utils C-equiv functions (#641)
* Add `noexcept` to `_utils` C-equiv functions The functions in `_utils` are effectively straight C functions. In Cython 0.x, these would have been treated as `noexcept` by default. However in Cython 3.x all functions are treated as potentially raising exceptions (including these). While that is a sensible default in general, these functions still won't raise exceptions. So tidy things up by adding `noexcept` to turn off the additional Cython checks emitted in and around them. * Swap order of `nogil` & `noexcept` Fixes a Cython warning when using the opposite ordering. * style: pre-commit fixes --------- Co-authored-by: David Stansby <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 4cd03c9 commit a345db6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

docs/release.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Fixes
1616
* Cleanup ``crc32c`` soft dependency.
1717
By :user:`John Kirkham <jakirkham>`, :issue:`637`
1818

19+
Improvements
20+
~~~~~~~~~~~~
21+
* Add `noexcept` to `_utils` C-equiv functions
22+
By :user:`John Kirkham <jakirkham>`, :issue:`641`.
1923

2024
.. _release_0.14.0:
2125

numcodecs/_utils.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
from libc.stdint cimport uint8_t, uint32_t
99

1010

11-
cdef inline void store_le32(uint8_t c[4], uint32_t i) nogil:
11+
cdef inline void store_le32(uint8_t c[4], uint32_t i) noexcept nogil:
1212
c[0] = i & 0xFF
1313
c[1] = (i >> 8) & 0xFF
1414
c[2] = (i >> 16) & 0xFF
1515
c[3] = (i >> 24) & 0xFF
1616

1717

18-
cdef inline uint32_t load_le32(const uint8_t c[4]) nogil:
18+
cdef inline uint32_t load_le32(const uint8_t c[4]) noexcept nogil:
1919
return (
2020
c[0] |
2121
(c[1] << 8) |

0 commit comments

Comments
 (0)