From b5638328312da66a1cd2357f48bac748d7d2d99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Gl=C3=A4=C3=9Fle?= Date: Fri, 13 Dec 2024 13:45:52 +0100 Subject: [PATCH] Declare _strip_comments noexcept for performance reasons 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. --- src/cpymad/libmadx.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpymad/libmadx.pyx b/src/cpymad/libmadx.pyx index 2dc0a3b4..ec50a3a3 100644 --- a/src/cpymad/libmadx.pyx +++ b/src/cpymad/libmadx.pyx @@ -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