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

Function update_thread_exception

crates/vm/src/vm/thread.rs:403–411  ·  view source on GitHub ↗
(exc: Option<PyBaseExceptionRef>)

Source from the content-addressed store, hash-verified

401/// Called from push_exception/pop_exception/set_exception.
402#[cfg(feature = "threading")]
403pub 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.

Callers 3

push_exceptionMethod · 0.85
pop_exceptionMethod · 0.85
set_exceptionMethod · 0.85

Calls 4

withMethod · 0.80
as_refMethod · 0.45
borrowMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected