1- # cython: preliminary_late_includes_cy28=True
1+ # cython: preliminary_late_includes_cy28=True, show_performance_hints=False
22"""
33Test interrupt and signal handling
44
@@ -58,6 +58,12 @@ cdef extern from "<pthread.h>" nogil:
5858
5959
6060cdef extern from * :
61+ """
62+ #if defined(__GNUC__) && !defined(__clang__)
63+ // disable warning (variable might be clobbered by longjmp)
64+ #pragma GCC diagnostic ignored "-Wclobbered"
65+ #endif
66+ """
6167 ctypedef int volatile_int " volatile int"
6268
6369
@@ -101,6 +107,9 @@ cdef void dereference_null_pointer() noexcept nogil:
101107 cdef volatile_int* ptr = < volatile_int* > (0 )
102108 ptr[0 ] += 1
103109
110+ # disable warning (infinite recursion in stack_overflow)
111+ cdef extern from * :
112+ ' #pragma GCC diagnostic ignored "-Winfinite-recursion"'
104113
105114cdef int stack_overflow(volatile_int* x = NULL ) noexcept nogil:
106115 cdef volatile_int a = 0
@@ -197,7 +206,7 @@ def subpython_err(command, **kwds):
197206 """
198207 argv = [sys.executable, ' -c' , command]
199208 P = Popen(argv, stdout = PIPE, stderr = PIPE, universal_newlines = True , ** kwds)
200- (out , err) = P.communicate()
209+ (_ , err) = P.communicate()
201210 sys.stdout.write(err)
202211
203212
@@ -249,7 +258,7 @@ def test_sig_str(long delay=DEFAULT_DELAY):
249258 signal_after_delay(SIGABRT, delay)
250259 infinite_loop()
251260
252- cdef c_test_sig_on_cython() noexcept :
261+ cdef c_test_sig_on_cython():
253262 sig_on()
254263 infinite_loop()
255264
@@ -977,7 +986,7 @@ def test_sig_occurred_dealloc():
977986 No current exception
978987
979988 """
980- x = DeallocDebug()
989+ _ = DeallocDebug()
981990 sig_str(" test_sig_occurred_dealloc()" )
982991 abort()
983992
@@ -1155,9 +1164,8 @@ def sig_on_bench():
11551164 >>> sig_on_bench()
11561165
11571166 """
1158- cdef int i
11591167 with nogil:
1160- for i in range (1000000 ):
1168+ for _ in range (1000000 ):
11611169 sig_on()
11621170 sig_off()
11631171
@@ -1171,9 +1179,8 @@ def sig_check_bench():
11711179 >>> sig_check_bench()
11721180
11731181 """
1174- cdef int i
11751182 with nogil:
1176- for i in range (1000000 ):
1183+ for _ in range (1000000 ):
11771184 sig_check()
11781185
11791186
@@ -1277,7 +1284,7 @@ def test_thread_sig_block(long delay=DEFAULT_DELAY):
12771284 >>> test_thread_sig_block()
12781285
12791286 """
1280- cdef pthread_t t1, t2
1287+ cdef pthread_t t1 = 0 , t2 = 0
12811288 with nogil:
12821289 sig_on()
12831290 if pthread_create(& t1, NULL , func_thread_sig_block, NULL ):
@@ -1293,8 +1300,7 @@ def test_thread_sig_block(long delay=DEFAULT_DELAY):
12931300
12941301cdef void * func_thread_sig_block(void * ignored) noexcept with gil:
12951302 # This is executed by the two threads spawned by test_thread_sig_block()
1296- cdef int n
1297- for n in range (1000000 ):
1303+ for _ in range (1000000 ):
12981304 sig_block()
12991305 if not (1 <= cysigs.block_sigint <= 2 ):
13001306 PyErr_SetString(RuntimeError , " sig_block() is not thread-safe" )
0 commit comments