changed unraisable exception type to base exception

- print exception type to screen to match cpython behaviour
- included sample script to illustrate behaviour at sys.exit()
This commit is contained in:
Jan Krecke committed 2022-12-25 13:58:15 +09:00
1 parent d1811c72e7
commit a442056e24
2 files changed
+9 -2

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
import atexit
import sys
def myexit():
sys.exit(2)
atexit.register(myexit)
+2 -2
View File
@@ -549,12 +549,12 @@ mod sys {
}
assert!(unraisable
.exc_type
.fast_issubclass(vm.ctx.exceptions.exception_type));
.fast_issubclass(vm.ctx.exceptions.base_exception_type));
// TODO: print module name and qualname
if !vm.is_none(&unraisable.exc_value) {
write!(stderr, ": ");
write!(stderr, "{}: ", unraisable.exc_type);
if let Ok(str) = unraisable.exc_value.str(vm) {
write!(stderr, "{}", str.as_str());
} else {