Add KeyboardInterrupt class

This commit is contained in:
coolreader18
2019-08-08 00:02:35 -05:00
parent a4ffc797bb
commit 513e4bf63e
2 changed files with 7 additions and 0 deletions

View File

@@ -915,6 +915,8 @@ pub fn make_module(vm: &VirtualMachine, module: PyObjectRef) {
"ResourceWarning" => ctx.exceptions.resource_warning.clone(),
"RuntimeWarning" => ctx.exceptions.runtime_warning.clone(),
"UserWarning" => ctx.exceptions.user_warning.clone(),
"KeyboardInterrupt" => ctx.exceptions.keyboard_interrupt.clone(),
});
}

View File

@@ -238,6 +238,8 @@ pub struct ExceptionZoo {
pub resource_warning: PyClassRef,
pub runtime_warning: PyClassRef,
pub user_warning: PyClassRef,
pub keyboard_interrupt: PyClassRef,
}
impl ExceptionZoo {
@@ -288,6 +290,8 @@ impl ExceptionZoo {
let runtime_warning = create_type("RuntimeWarning", &type_type, &warning);
let user_warning = create_type("UserWarning", &type_type, &warning);
let keyboard_interrupt = create_type("KeyboardInterrupt", &type_type, &base_exception_type);
ExceptionZoo {
arithmetic_error,
assertion_error,
@@ -330,6 +334,7 @@ impl ExceptionZoo {
runtime_warning,
reference_error,
user_warning,
keyboard_interrupt,
}
}
}