Skip to content

Commit f576d31

Browse files
authored
[3.11] pythongh-106883: Make test_current_frames_exceptions_deadlock faster (python#131182)
1 parent 6b37486 commit f576d31

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Lib/test/test_sys.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ def g456():
477477
@threading_helper.reap_threads
478478
@threading_helper.requires_working_threading()
479479
@support.requires_fork()
480+
@support.requires_resource('cpu')
480481
def test_current_frames_exceptions_deadlock(self):
481482
"""
482483
Reproduce the bug raised in GH-106883 and GH-116969.
@@ -515,19 +516,14 @@ def thread_function(num_objects):
515516

516517
# The number of objects should be big enough to increase the
517518
# chances to call the GC.
518-
NUM_OBJECTS = 1000
519-
NUM_THREADS = 10
520-
521-
# 40 seconds should be enough for the test to be executed: if it
522-
# is more than 40 seconds it means that the process is in deadlock
523-
# hence the test fails
524-
TIMEOUT = 40
519+
NUM_OBJECTS = 100
520+
NUM_THREADS = 2
525521

526522
# Test the sys._current_frames and sys._current_exceptions calls
527523
pid = os.fork()
528524
if pid: # parent process
529525
try:
530-
support.wait_process(pid, exitcode=0, timeout=TIMEOUT)
526+
support.wait_process(pid, exitcode=0, timeout=support.SHORT_TIMEOUT)
531527
except KeyboardInterrupt:
532528
# When pressing CTRL-C kill the deadlocked process
533529
os.kill(pid, signal.SIGTERM)

0 commit comments

Comments
 (0)