From cecd8d9462e9c1a58aeae25894aac3e9fa2e2e3a Mon Sep 17 00:00:00 2001 From: robot-piglet Date: Tue, 2 Sep 2025 11:39:17 +0300 Subject: Intermediate changes commit_hash:3226aa9d9f0af82e14a84916ce0f450ded26504f --- library/python/pytest/plugins/ya.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'library/python') diff --git a/library/python/pytest/plugins/ya.py b/library/python/pytest/plugins/ya.py index 9afb02185c7..8b763af783b 100644 --- a/library/python/pytest/plugins/ya.py +++ b/library/python/pytest/plugins/ya.py @@ -341,7 +341,9 @@ def _graceful_shutdown(*args): library.python.coverage.stop_coverage_tracing() except ImportError: pass - traceback.print_stack(file=sys.stderr) + stack = traceback.format_stack() + # NOTE: Using os.write because it's reentrant, Python I/O stack isn't https://bugs.python.org/issue24283 + os.write(sys.stderr.fileno(), b''.join(item.encode() for item in stack)) capman = pytest_config.pluginmanager.getplugin("capturemanager") capman.suspend(in_=True) _graceful_shutdown_on_log(not capman.is_globally_capturing()) -- cgit v1.3