(callable, p=None)
| 394 | |
| 395 | |
| 396 | def 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 | |
| 413 | def show_events(callable): |
no test coverage detected