Add MemoryError

This commit is contained in:
Aviv Palivoda
2019-10-26 19:43:56 +03:00
parent a9c2f5f711
commit 2a60fbce8c
2 changed files with 4 additions and 0 deletions

View File

@@ -884,6 +884,7 @@ pub fn make_module(vm: &VirtualMachine, module: PyObjectRef) {
"OSError" => ctx.exceptions.os_error.clone(),
"ModuleNotFoundError" => ctx.exceptions.module_not_found_error.clone(),
"EOFError" => ctx.exceptions.eof_error.clone(),
"MemoryError" => ctx.exceptions.memory_error.clone(),
// Warnings
"Warning" => ctx.exceptions.warning.clone(),

View File

@@ -272,6 +272,7 @@ pub struct ExceptionZoo {
pub unicode_translate_error: PyClassRef,
pub zero_division_error: PyClassRef,
pub eof_error: PyClassRef,
pub memory_error: PyClassRef,
pub warning: PyClassRef,
pub bytes_warning: PyClassRef,
@@ -326,6 +327,7 @@ impl ExceptionZoo {
let unicode_encode_error = create_type("UnicodeEncodeError", &type_type, &unicode_error);
let unicode_translate_error =
create_type("UnicodeTranslateError", &type_type, &unicode_error);
let memory_error = create_type("MemoryError", &type_type, &exception_type);
let warning = create_type("Warning", &type_type, &exception_type);
let bytes_warning = create_type("BytesWarning", &type_type, &warning);
@@ -376,6 +378,7 @@ impl ExceptionZoo {
unicode_translate_error,
zero_division_error,
eof_error,
memory_error,
warning,
bytes_warning,
unicode_warning,