Skip to content

Commit

Permalink
Fix the test
Browse files Browse the repository at this point in the history
  • Loading branch information
user202729 committed Feb 28, 2025
1 parent 066f8d3 commit 6f7ca55
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/cysignals/tests.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ from libc.errno cimport errno
from posix.signal cimport sigaltstack, stack_t, SS_ONSTACK

from cpython cimport PyErr_SetString
from cpython.exc cimport PyErr_CheckSignals

from .signals cimport *
from .memory cimport *
Expand Down Expand Up @@ -805,6 +806,13 @@ def test_interrupt_bomb(long n=100, long p=10):
i = 0
while True:
try:
# For some reason, without the line below, the exception
# will be detected too late (outside the try/except block)
# and the KeyboardInterrupt will be leaked outside,
# making the test fail.
# We can't really call PyErr_CheckSignals() from inside
# sig_on() because it does not hold the GIL.
PyErr_CheckSignals()
with nogil:
sig_on()
ms_sleep(1000)
Expand Down

0 comments on commit 6f7ca55

Please sign in to comment.