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

Function capture_warnings

tools/python-3.11.9-amd64/Lib/idlelib/pyshell.py:92–103  ·  view source on GitHub ↗

Replace warning.showwarning with idle_showwarning, or reverse.

(capture)

Source from the content-addressed store, hash-verified

90_warnings_showwarning = None
91
92def capture_warnings(capture):
93 "Replace warning.showwarning with idle_showwarning, or reverse."
94
95 global _warnings_showwarning
96 if capture:
97 if _warnings_showwarning is None:
98 _warnings_showwarning = warnings.showwarning
99 warnings.showwarning = idle_showwarning
100 else:
101 if _warnings_showwarning is not None:
102 warnings.showwarning = _warnings_showwarning
103 _warnings_showwarning = None
104
105capture_warnings(True)
106

Callers 2

pyshell.pyFile · 0.70
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected