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

Function capture_warnings

Lib/idlelib/pyshell.py:85–96  ·  view source on GitHub ↗

Replace warning.showwarning with idle_showwarning, or reverse.

(capture)

Source from the content-addressed store, hash-verified

83_warnings_showwarning = None
84
85def capture_warnings(capture):
86 "Replace warning.showwarning with idle_showwarning, or reverse."
87
88 global _warnings_showwarning
89 if capture:
90 if _warnings_showwarning is None:
91 _warnings_showwarning = warnings.showwarning
92 warnings.showwarning = idle_showwarning
93 else:
94 if _warnings_showwarning is not None:
95 warnings.showwarning = _warnings_showwarning
96 _warnings_showwarning = None
97
98capture_warnings(True)
99

Callers 2

pyshell.pyFile · 0.70
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…