1
- # cython: preliminary_late_includes_cy28=True
1
+ # cython: preliminary_late_includes_cy28=True, show_performance_hints=False
2
2
"""
3
3
Test interrupt and signal handling
4
4
@@ -58,6 +58,12 @@ cdef extern from "<pthread.h>" nogil:
58
58
59
59
60
60
cdef 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
+ """
61
67
ctypedef int volatile_int " volatile int"
62
68
63
69
@@ -101,6 +107,9 @@ cdef void dereference_null_pointer() noexcept nogil:
101
107
cdef volatile_int* ptr = < volatile_int* > (0 )
102
108
ptr[0 ] += 1
103
109
110
+ # disable warning (infinite recursion in stack_overflow)
111
+ cdef extern from * :
112
+ ' #pragma GCC diagnostic ignored "-Winfinite-recursion"'
104
113
105
114
cdef int stack_overflow(volatile_int* x = NULL ) noexcept nogil:
106
115
cdef volatile_int a = 0
@@ -197,7 +206,7 @@ def subpython_err(command, **kwds):
197
206
"""
198
207
argv = [sys.executable, ' -c' , command]
199
208
P = Popen(argv, stdout = PIPE, stderr = PIPE, universal_newlines = True , ** kwds)
200
- (out , err) = P.communicate()
209
+ (_ , err) = P.communicate()
201
210
sys.stdout.write(err)
202
211
203
212
@@ -249,7 +258,7 @@ def test_sig_str(long delay=DEFAULT_DELAY):
249
258
signal_after_delay(SIGABRT, delay)
250
259
infinite_loop()
251
260
252
- cdef c_test_sig_on_cython() noexcept :
261
+ cdef c_test_sig_on_cython():
253
262
sig_on()
254
263
infinite_loop()
255
264
@@ -977,7 +986,7 @@ def test_sig_occurred_dealloc():
977
986
No current exception
978
987
979
988
"""
980
- x = DeallocDebug()
989
+ _ = DeallocDebug()
981
990
sig_str(" test_sig_occurred_dealloc()" )
982
991
abort()
983
992
@@ -1155,9 +1164,8 @@ def sig_on_bench():
1155
1164
>>> sig_on_bench()
1156
1165
1157
1166
"""
1158
- cdef int i
1159
1167
with nogil:
1160
- for i in range (1000000 ):
1168
+ for _ in range (1000000 ):
1161
1169
sig_on()
1162
1170
sig_off()
1163
1171
@@ -1171,9 +1179,8 @@ def sig_check_bench():
1171
1179
>>> sig_check_bench()
1172
1180
1173
1181
"""
1174
- cdef int i
1175
1182
with nogil:
1176
- for i in range (1000000 ):
1183
+ for _ in range (1000000 ):
1177
1184
sig_check()
1178
1185
1179
1186
@@ -1277,7 +1284,7 @@ def test_thread_sig_block(long delay=DEFAULT_DELAY):
1277
1284
>>> test_thread_sig_block()
1278
1285
1279
1286
"""
1280
- cdef pthread_t t1, t2
1287
+ cdef pthread_t t1 = 0 , t2 = 0
1281
1288
with nogil:
1282
1289
sig_on()
1283
1290
if pthread_create(& t1, NULL , func_thread_sig_block, NULL ):
@@ -1293,8 +1300,7 @@ def test_thread_sig_block(long delay=DEFAULT_DELAY):
1293
1300
1294
1301
cdef void * func_thread_sig_block(void * ignored) noexcept with gil:
1295
1302
# 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 ):
1298
1304
sig_block()
1299
1305
if not (1 <= cysigs.block_sigint <= 2 ):
1300
1306
PyErr_SetString(RuntimeError , " sig_block() is not thread-safe" )
0 commit comments