MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / idle_showwarning

Function idle_showwarning

tools/python-3.11.9-amd64/Lib/idlelib/pyshell.py:73–88  ·  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

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

Callers

nothing calls this directly

Calls 2

idle_formatwarningFunction · 0.90
writeMethod · 0.45

Tested by

no test coverage detected