Mark functions as noexcept
to support Cython 3
#6936
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR marks functions as
noexcept
.noexcept
keyword was introduced in Cython 3.0 b1 and Cython 0.29.31 to explicitly declare function as not propagating exceptions.This is important because exceptions are propagated by default in Cython3 [1]. Following functions are marked asnoexcept
in this PR:void
return type - function returningvoid
in Cython 3 is by default checking an exception after every call. This can possibly end up as performance degradation when function is also marked asnogil
- see [1] for details.inline
functions -inline
functions should be performance sensitive so I marked them asnoexcept
to avoid any (even minor) overheadThis PR is bumping Cython version to 0.29.32. For compilation with Cython3, master branch or Cython 3.0 beta 3 (not released in time of creating this PR) should be used.
[1] https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#exception-values-and-noexcept
[2] https://cython.readthedocs.io/en/latest/src/userguide/language_basics.html#error-return-values
Checklist
./doc/examples
(new features only)./benchmarks
, if your changes aren't covered by anexisting benchmark
For reviewers
later.
__init__.py
.doc/release/release_dev.rst
.example, to backport to v0.19.x after merging, add the following in a PR
comment:
@meeseeksdev backport to v0.19.x
run-benchmark
label. To rerun, the labelcan be removed and then added again. The benchmark output can be checked in
the "Actions" tab.