(exc: Option<PyBaseExceptionRef>)
| 401 | /// Called from push_exception/pop_exception/set_exception. |
| 402 | #[cfg(feature = "threading")] |
| 403 | pub fn update_thread_exception(exc: Option<PyBaseExceptionRef>) { |
| 404 | CURRENT_THREAD_SLOT.with(|slot| { |
| 405 | if let Some(s) = slot.borrow().as_ref() { |
| 406 | // SAFETY: Called only from the owning thread. The old ref is dropped |
| 407 | // here on the owning thread, which is safe. |
| 408 | let _old = unsafe { s.exception.swap(exc) }; |
| 409 | } |
| 410 | }); |
| 411 | } |
| 412 | |
| 413 | /// Collect all threads' current exceptions for sys._current_exceptions(). |
| 414 | /// Acquires the global registry lock briefly, then reads each slot's exception atomically. |
no test coverage detected