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

Function idle_showwarning

Lib/idlelib/pyshell.py:66–81  ·  view source on GitHub ↗

Show Idle-format warning (after replacing warnings.showwarning). The differences are the formatter called, the file=None replacement, which can be None, the capture of the consequence AttributeError, and the output of a hard-coded prompt.

(
        message, category, filename, lineno, file=None, line=None)

Source from the content-addressed store, hash-verified

64warning_stream = sys.__stderr__ # None, at least on Windows, if no console.
65
66def idle_showwarning(
67 message, category, filename, lineno, file=None, line=None):
68 """Show Idle-format warning (after replacing warnings.showwarning).
69
70 The differences are the formatter called, the file=None replacement,
71 which can be None, the capture of the consequence AttributeError,
72 and the output of a hard-coded prompt.
73 """
74 if file is None:
75 file = warning_stream
76 try:
77 file.write(idle_formatwarning(
78 message, category, filename, lineno, line=line))
79 file.write(">>> ")
80 except (AttributeError, OSError):
81 pass # if file (probably __stderr__) is invalid, skip warning.
82
83_warnings_showwarning = None
84

Callers

nothing calls this directly

Calls 2

idle_formatwarningFunction · 0.90
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…