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

Function print_exc

Lib/idlelib/run.py:253–276  ·  view source on GitHub ↗
(typ, exc, tb)

Source from the content-addressed store, hash-verified

251 seen = set()
252
253 def print_exc(typ, exc, tb):
254 seen.add(id(exc))
255 context = exc.__context__
256 cause = exc.__cause__
257 if cause is not None and id(cause) not in seen:
258 print_exc(type(cause), cause, cause.__traceback__)
259 print("\nThe above exception was the direct cause "
260 "of the following exception:\n", file=efile)
261 elif (context is not None and
262 not exc.__suppress_context__ and
263 id(context) not in seen):
264 print_exc(type(context), context, context.__traceback__)
265 print("\nDuring handling of the above exception, "
266 "another exception occurred:\n", file=efile)
267 if tb:
268 tbe = traceback.extract_tb(tb)
269 print('Traceback (most recent call last):', file=efile)
270 exclude = ("run.py", "rpc.py", "threading.py", "queue.py",
271 "debugger_r.py", "bdb.py")
272 cleanup_traceback(tbe, exclude)
273 traceback.print_list(tbe, file=efile)
274 lines = get_message_lines(typ, exc, tb)
275 for line in lines:
276 print(line, end='', file=efile)
277
278 print_exc(typ, val, tb)
279

Callers 1

print_exceptionFunction · 0.70

Calls 4

idFunction · 0.85
cleanup_tracebackFunction · 0.85
get_message_linesFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…