Skip to content

Commit 2a1aed0

Browse files
authored
bpo-30107: don't dump core on expected test_io crash (#1235)
test_io has two unit tests which trigger a deadlock: * test_daemon_threads_shutdown_stdout_deadlock() * test_daemon_threads_shutdown_stderr_deadlock() These tests call Py_FatalError() if the expected bug is triggered which calls abort(). Use test.support.SuppressCrashReport to prevent the creation on a core dump, to fix the warning: Warning -- files was modified by test_io Before: [] After: ['python.core']
1 parent a2c877c commit 2a1aed0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/test/test_io.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3732,6 +3732,7 @@ def check_daemon_threads_shutdown_deadlock(self, stream_name):
37323732
import sys
37333733
import time
37343734
import threading
3735+
from test.support import SuppressCrashReport
37353736
37363737
file = sys.{stream_name}
37373738
@@ -3740,6 +3741,10 @@ def run():
37403741
file.write('.')
37413742
file.flush()
37423743
3744+
crash = SuppressCrashReport()
3745+
crash.__enter__()
3746+
# don't call __exit__(): the crash occurs at Python shutdown
3747+
37433748
thread = threading.Thread(target=run)
37443749
thread.daemon = True
37453750
thread.start()

0 commit comments

Comments
 (0)