Skip to content

Commit b984a05

Browse files
authored
bpo-30107: don't dump core on expected test_io crash (#1235) (#1241)
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'] (cherry picked from commit 2a1aed0)
1 parent 4837295 commit b984a05

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
@@ -3720,6 +3720,7 @@ def check_daemon_threads_shutdown_deadlock(self, stream_name):
37203720
import sys
37213721
import time
37223722
import threading
3723+
from test.support import SuppressCrashReport
37233724
37243725
file = sys.{stream_name}
37253726
@@ -3728,6 +3729,10 @@ def run():
37283729
file.write('.')
37293730
file.flush()
37303731
3732+
crash = SuppressCrashReport()
3733+
crash.__enter__()
3734+
# don't call __exit__(): the crash occurs at Python shutdown
3735+
37313736
thread = threading.Thread(target=run)
37323737
thread.daemon = True
37333738
thread.start()

0 commit comments

Comments
 (0)