From 2a60fbce8c18bd44d07208f2f6bb2b6b6c280043 Mon Sep 17 00:00:00 2001 From: Aviv Palivoda Date: Sat, 26 Oct 2019 19:43:56 +0300 Subject: [PATCH] Add MemoryError --- vm/src/builtins.rs | 1 + vm/src/exceptions.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/vm/src/builtins.rs b/vm/src/builtins.rs index eb509847b..82af90fd9 100644 --- a/vm/src/builtins.rs +++ b/vm/src/builtins.rs @@ -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(), diff --git a/vm/src/exceptions.rs b/vm/src/exceptions.rs index f671643a4..8b359cc0f 100644 --- a/vm/src/exceptions.rs +++ b/vm/src/exceptions.rs @@ -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,