8000 [3.11] gh-110647: Fix signal test_stress_modifying_handlers() (GH-110… · python/cpython@46347d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 46347d3

Browse files
[3.11] gh-110647: Fix signal test_stress_modifying_handlers() (GH-110650) (#110659)
gh-110647: Fix signal test_stress_modifying_handlers() (GH-110650) * cycle_handlers() now waits until at least one signal is received. * num_received_signals can be equal to num_sent_signals. (cherry picked from commit e07c37c) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent a009bb8 commit 46347d3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Lib/test/test_signal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ def set_interrupts():
13471347
num_sent_signals += 1
13481348

13491349
def cycle_handlers():
1350-
while num_sent_signals < 100:
1350+
while num_sent_signals < 100 or num_received_signals < 1:
13511351
for i in range(20000):
13521352
# Cycle between a Python-defined and a non-Python handler
13531353
for handler in [custom_handler, signal.SIG_IGN]:
@@ -1380,7 +1380,7 @@ def cycle_handlers():
13801380
if not ignored:
13811381
# Sanity check that some signals were received, but not all
13821382
self.assertGreater(num_received_signals, 0)
1383-
self.assertLess(num_received_signals, num_sent_signals)
1383+
self.assertLessEqual(num_received_signals, num_sent_signals)
13841384
finally:
13851385
do_stop = True
13861386
t.join()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix test_stress_modifying_handlers() of test_signal. Patch by Victor
2+
Stinner.

0 commit comments

Comments
 (0)
0