Skip to content

Commit

Permalink
Declare _strip_comments noexcept for performance reasons
Browse files Browse the repository at this point in the history
performance hint: src/cpymad/libmadx.pyx:1256:0: Exception check on '_strip_comments' will always require the GIL to be acquired.
Possible solutions:
        1. Declare '_strip_comments' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
        2. Use an 'int' return type on '_strip_comments' to allow an error code to be returned.
  • Loading branch information
coldfix committed Dec 13, 2024
1 parent 07d0a0f commit fef4ab8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cpymad/libmadx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ cdef clib.variable* _get_var(name) except NULL:
return var


cdef void _strip_comments(char* text) nogil:
cdef void _strip_comments(char* text) nogil noexcept:
cdef int in_quotes = 0
cdef char* dest = text
cdef char c, d
Expand Down

0 comments on commit fef4ab8

Please sign in to comment.