Skip to content

Commit c01a92b

Browse files
committed
cython warnings: avoid unused variables
1 parent 55fe1c6 commit c01a92b

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

src/cysignals/pysignals.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@ cdef class containsignals:
441441
cdef sigset_t unblock
442442

443443
def __init__(self, signals=None):
444-
cdef int s
445444
if signals is None:
446445
self.signals = [s for s in range(1, 32) if s != SIGKILL and s != SIGSTOP]
447446
else:

src/cysignals/signals.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ def sig_print_exception(sig, msg=None):
246246

247247
try:
248248
sig_raise_exception(sig, m)
249-
except BaseException as e:
249+
except BaseException:
250250
# Print exception to stdout without traceback
251251
import sys, traceback
252-
typ, val, tb = sys.exc_info()
252+
typ, val, _ = sys.exc_info()
253253
traceback.print_exception(typ, val, None, file=sys.stdout, chain=False)
254254

255255

src/cysignals/tests.pyx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def subpython_err(command, **kwds):
202202
"""
203203
argv = [sys.executable, '-c', command]
204204
P = Popen(argv, stdout=PIPE, stderr=PIPE, universal_newlines=True, **kwds)
205-
(out, err) = P.communicate()
205+
(_, err) = P.communicate()
206206
sys.stdout.write(err)
207207

208208

@@ -982,7 +982,7 @@ def test_sig_occurred_dealloc():
982982
No current exception
983983
984984
"""
985-
x = DeallocDebug()
985+
_ = DeallocDebug()
986986
sig_str("test_sig_occurred_dealloc()")
987987
abort()
988988

@@ -1160,9 +1160,8 @@ def sig_on_bench():
11601160
>>> sig_on_bench()
11611161
11621162
"""
1163-
cdef int i
11641163
with nogil:
1165-
for i in range(1000000):
1164+
for _ in range(1000000):
11661165
sig_on()
11671166
sig_off()
11681167

@@ -1176,9 +1175,8 @@ def sig_check_bench():
11761175
>>> sig_check_bench()
11771176
11781177
"""
1179-
cdef int i
11801178
with nogil:
1181-
for i in range(1000000):
1179+
for _ in range(1000000):
11821180
sig_check()
11831181

11841182

@@ -1298,8 +1296,7 @@ def test_thread_sig_block(long delay=DEFAULT_DELAY):
12981296

12991297
cdef void* func_thread_sig_block(void* ignored) noexcept with gil:
13001298
# This is executed by the two threads spawned by test_thread_sig_block()
1301-
cdef int n
1302-
for n in range(1000000):
1299+
for _ in range(1000000):
13031300
sig_block()
13041301
if not (1 <= cysigs.block_sigint <= 2):
13051302
PyErr_SetString(RuntimeError, "sig_block() is not thread-safe")

0 commit comments

Comments
 (0)