mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
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:
1 parent
d1811c72e7
commit
a442056e24
2 files changed
+9
-2
No files matched your search
@@ -0,0 +1,7 @@
|
||||
import atexit
|
||||
import sys
|
||||
|
||||
def myexit():
|
||||
sys.exit(2)
|
||||
|
||||
atexit.register(myexit)
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user