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

Function capture_events

Lib/test/test_sys_setprofile.py:396–410  ·  view source on GitHub ↗
(callable, p=None)

Source from the content-addressed store, hash-verified

394
395
396def capture_events(callable, p=None):
397 if p is None:
398 p = HookWatcher()
399 # Disable the garbage collector. This prevents __del__s from showing up in
400 # traces.
401 old_gc = gc.isenabled()
402 gc.disable()
403 try:
404 sys.setprofile(p.callback)
405 protect(callable, p)
406 sys.setprofile(None)
407 finally:
408 if old_gc:
409 gc.enable()
410 return p.get_events()[1:-1]
411
412
413def show_events(callable):

Callers 2

check_eventsMethod · 0.85
show_eventsFunction · 0.85

Calls 5

get_eventsMethod · 0.95
HookWatcherClass · 0.85
protectFunction · 0.85
disableMethod · 0.45
enableMethod · 0.45

Tested by

no test coverage detected