MCPcopy Index your code
hub / github.com/python/cpython / print_warning

Function print_warning

Lib/test/support/__init__.py:1500–1506  ·  view source on GitHub ↗
(msg)

Source from the content-addressed store, hash-verified

1498
1499
1500def print_warning(msg):
1501 # bpo-45410: Explicitly flush stdout to keep logs in order
1502 flush_std_streams()
1503 stream = print_warning.orig_stderr
1504 for line in msg.splitlines():
1505 print(f"Warning -- {line}", file=stream)
1506 stream.flush()
1507
1508# bpo-39983: Store the original sys.stderr at Python startup to be able to
1509# log warnings even if sys.stderr is captured temporarily by a test.

Callers 1

reap_childrenFunction · 0.70

Calls 3

flush_std_streamsFunction · 0.85
splitlinesMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…