(
*, config: Config, prev_hook: Callable[[threading.ExceptHookArgs], object]
)
| 75 | |
| 76 | |
| 77 | def cleanup( |
| 78 | *, config: Config, prev_hook: Callable[[threading.ExceptHookArgs], object] |
| 79 | ) -> None: |
| 80 | try: |
| 81 | try: |
| 82 | # We don't join threads here, so exceptions raised from any |
| 83 | # threads still running by the time _threading_atexits joins them |
| 84 | # do not get captured (see #13027). |
| 85 | collect_thread_exception(config) |
| 86 | finally: |
| 87 | threading.excepthook = prev_hook |
| 88 | finally: |
| 89 | del config.stash[thread_exceptions] |
| 90 | |
| 91 | |
| 92 | def thread_exception_hook( |