Skip to content

Commit 8e26a28

Browse files
committed
unraisable
1 parent 231b3b5 commit 8e26a28

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

crates/vm/src/vm/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,16 @@ impl VirtualMachine {
550550

551551
#[cold]
552552
pub fn run_unraisable(&self, e: PyBaseExceptionRef, msg: Option<String>, object: PyObjectRef) {
553+
// Suppress unraisable exceptions during interpreter finalization.
554+
// daemon thread exceptions and __del__ errors are silently ignored during shutdown.
555+
if self
556+
.state
557+
.finalizing
558+
.load(std::sync::atomic::Ordering::Acquire)
559+
{
560+
return;
561+
}
562+
553563
let sys_module = self.import("sys", 0).unwrap();
554564
let unraisablehook = sys_module.get_attr("unraisablehook", self).unwrap();
555565

0 commit comments

Comments
 (0)