summaryrefslogtreecommitdiffstats
path: root/library/python
diff options
context:
space:
mode:
Diffstat (limited to 'library/python')
-rw-r--r--library/python/pytest/plugins/ya.py4
1 files changed, 3 insertions, 1 deletions
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())