mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 11:14:38 +08:00
3 files changed
+8
No files matched your search
@@ -0,0 +1,4 @@
|
||||
from testutils import assert_raises
|
||||
|
||||
with assert_raises(SystemExit):
|
||||
exit()
|
||||
@@ -883,6 +883,7 @@ pub fn make_module(vm: &VirtualMachine, module: PyObjectRef) {
|
||||
"UserWarning" => ctx.exceptions.user_warning.clone(),
|
||||
|
||||
"KeyboardInterrupt" => ctx.exceptions.keyboard_interrupt.clone(),
|
||||
"SystemExit" => ctx.exceptions.system_exit.clone(),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -252,6 +252,7 @@ pub struct ExceptionZoo {
|
||||
pub user_warning: PyClassRef,
|
||||
|
||||
pub keyboard_interrupt: PyClassRef,
|
||||
pub system_exit: PyClassRef,
|
||||
}
|
||||
|
||||
impl ExceptionZoo {
|
||||
@@ -303,6 +304,7 @@ impl ExceptionZoo {
|
||||
let user_warning = create_type("UserWarning", &type_type, &warning);
|
||||
|
||||
let keyboard_interrupt = create_type("KeyboardInterrupt", &type_type, &base_exception_type);
|
||||
let system_exit = create_type("SystemExit", &type_type, &base_exception_type);
|
||||
|
||||
ExceptionZoo {
|
||||
arithmetic_error,
|
||||
@@ -347,6 +349,7 @@ impl ExceptionZoo {
|
||||
reference_error,
|
||||
user_warning,
|
||||
keyboard_interrupt,
|
||||
system_exit,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user