-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
MNT: Explicitly set cdef functions as noexcept #53144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9da685c
to
d14b6d3
Compare
Thanks @matusvalo |
@@ -595,7 +595,7 @@ cdef check_overflows(_TSObject obj, NPY_DATETIMEUNIT reso=NPY_FR_ns): | |||
# ---------------------------------------------------------------------- | |||
# Localization | |||
|
|||
cdef void _localize_tso(_TSObject obj, tzinfo tz, NPY_DATETIMEUNIT reso): | |||
cdef void _localize_tso(_TSObject obj, tzinfo tz, NPY_DATETIMEUNIT reso) noexcept: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really noexcept
? I think the Localizer
constructor can raise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Cython 0.29.X the default exception handling is noexcept
hence the exception was not propagated even before this PR. If an exception should be propagated, one should consider changing return type from void
to int
to avoid checking exception after every function call.
* Explicitly set cdef functions as noexcept * Make linter happy
* Explicitly set cdef functions as noexcept * Make linter happy
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.This PR marks functions returning
void
asnoexcept
to avoid checking an exception after every function call.inline
functions are marked too to avoid unnecessary overhead. The improvement is only in Cython 3. In Cython 0.29.Xnoexcept
keyword is ignored. See #53125 (comment) for details.