Content-Length: 2192 | pFad | http://github.com/python/cpython/pull/110659.patch
thub.com
From 0cec86e612facc57052eb95c15e81eba8edbc61e Mon Sep 17 00:00:00 2001
From: Victor Stinner
Date: Wed, 11 Oct 2023 01:59:43 +0200
Subject: [PATCH] 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 e07c37cd5212c9d13749b4d02a1d68e1efcba6cf)
Co-authored-by: Victor Stinner
---
Lib/test/test_signal.py | 4 ++--
.../next/Tests/2023-10-10-23-20-13.gh-issue-110647.jKG3sY.rst | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
create mode 100644 Misc/NEWS.d/next/Tests/2023-10-10-23-20-13.gh-issue-110647.jKG3sY.rst
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index a00c7e539400d9..0f3343b10e4a07 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -1347,7 +1347,7 @@ def set_interrupts():
num_sent_signals += 1
def cycle_handlers():
- while num_sent_signals < 100:
+ while num_sent_signals < 100 or num_received_signals < 1:
for i in range(20000):
# Cycle between a Python-defined and a non-Python handler
for handler in [custom_handler, signal.SIG_IGN]:
@@ -1380,7 +1380,7 @@ def cycle_handlers():
if not ignored:
# Sanity check that some signals were received, but not all
self.assertGreater(num_received_signals, 0)
- self.assertLess(num_received_signals, num_sent_signals)
+ self.assertLessEqual(num_received_signals, num_sent_signals)
finally:
do_stop = True
t.join()
diff --git a/Misc/NEWS.d/next/Tests/2023-10-10-23-20-13.gh-issue-110647.jKG3sY.rst b/Misc/NEWS.d/next/Tests/2023-10-10-23-20-13.gh-issue-110647.jKG3sY.rst
new file mode 100644
index 00000000000000..00f38c844755ec
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2023-10-10-23-20-13.gh-issue-110647.jKG3sY.rst
@@ -0,0 +1,2 @@
+Fix test_stress_modifying_handlers() of test_signal. Patch by Victor
+Stinner.
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/python/cpython/pull/110659.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy