Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Lib/test/_test_atexit.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,19 @@ def func2(*args, **kwargs):
('func2', (), {}),
('func1', (1, 2), {})])

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_badargs(self):
def func():
pass

# func() has no parameter, but it's called with 2 parameters
self.assert_raises_unraisable(TypeError, func, 1 ,2)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_raise(self):
def raise_type_error():
raise TypeError

self.assert_raises_unraisable(TypeError, raise_type_error)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_raise_unnormalized(self):
# bpo-10756: Make sure that an unnormalized exception is handled
# properly.
Expand All @@ -71,7 +68,6 @@ def div_zero():

self.assert_raises_unraisable(ZeroDivisionError, div_zero)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_exit(self):
self.assert_raises_unraisable(SystemExit, sys.exit)

Expand Down Expand Up @@ -122,7 +118,6 @@ def test_bound_methods(self):
atexit._run_exitfuncs()
self.assertEqual(l, [5])

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_atexit_with_unregistered_function(self):
# See bpo-46025 for more info
def func():
Expand Down
10 changes: 9 additions & 1 deletion crates/vm/src/stdlib/atexit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ mod atexit {
for (func, args) in funcs.into_iter().rev() {
if let Err(e) = func.call(args, vm) {
let exit = e.fast_isinstance(vm.ctx.exceptions.system_exit);
vm.run_unraisable(e, Some("Error in atexit._run_exitfuncs".to_owned()), func);
let msg = func
.repr(vm)
.map(|r| {
format!("Exception ignored in atexit callback {}", r.as_wtf8())
})
.unwrap_or_else(|_| {
"Exception ignored in atexit callback".to_owned()
});
vm.run_unraisable(e, Some(msg), vm.ctx.none());
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
if exit {
break;
}
Expand Down
Loading