MCPcopy Create free account
hub / github.com/pybind/pybind11 / hook

Function hook

tests/test_exceptions.py:113–119  ·  view source on GitHub ↗
(unraisable_hook_args)

Source from the content-addressed store, hash-verified

111 default_hook = sys.__unraisablehook__
112
113 def hook(unraisable_hook_args):
114 exc_type, exc_value, exc_tb, err_msg, obj = unraisable_hook_args
115 if obj == "already_set demo":
116 nonlocal triggered
117 triggered = True
118 default_hook(unraisable_hook_args)
119 return
120
121 # Use monkeypatch so pytest can apply and remove the patch as appropriate
122 monkeypatch.setattr(sys, "unraisablehook", hook)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected