MCPcopy Index your code
hub / github.com/RustPython/RustPython / excepthook

Function excepthook

Lib/threading.py:1273–1301  ·  view source on GitHub ↗

Handle uncaught Thread.run() exception.

(args, /)

Source from the content-addressed store, hash-verified

1271 return _ExceptHookArgs(*args)
1272
1273 def excepthook(args, /):
1274 """
1275 Handle uncaught Thread.run() exception.
1276 """
1277 if args.exc_type == SystemExit:
1278 # silently ignore SystemExit
1279 return
1280
1281 if _sys is not None and _sys.stderr is not None:
1282 stderr = _sys.stderr
1283 elif args.thread is not None:
1284 stderr = args.thread._stderr
1285 if stderr is None:
1286 # do nothing if sys.stderr is None and sys.stderr was None
1287 # when the thread was created
1288 return
1289 else:
1290 # do nothing if sys.stderr is None and args.thread is None
1291 return
1292
1293 if args.thread is not None:
1294 name = args.thread.name
1295 else:
1296 name = get_ident()
1297 print(f"Exception in thread {name}:",
1298 file=stderr, flush=True)
1299 _print_exception(args.exc_type, args.exc_value, args.exc_traceback,
1300 file=stderr)
1301 stderr.flush()
1302
1303
1304# Original value of threading.excepthook

Callers

nothing calls this directly

Calls 3

get_identFunction · 0.70
printFunction · 0.50
flushMethod · 0.45

Tested by

no test coverage detected