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

Function hook

Lib/test/audit-tests.py:346–352  ·  view source on GitHub ↗
(event, args)

Source from the content-addressed store, hash-verified

344 sys.__excepthook__(exc_type, exc_value, exc_tb)
345
346 def hook(event, args):
347 if event == "sys.excepthook":
348 if not isinstance(args[2], args[1]):
349 raise TypeError(f"Expected isinstance({args[2]!r}, " f"{args[1]!r})")
350 if args[0] != excepthook:
351 raise ValueError(f"Expected {args[0]} == {excepthook}")
352 print(event, repr(args[2]))
353
354 sys.addaudithook(hook)
355 sys.excepthook = excepthook

Callers 2

invoke_excepthookFunction · 0.50
_path_hooksMethod · 0.50

Calls 2

ThreadNewAbortErrorClass · 0.85
startswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…