fix: register arithmetic errors in builtins module

This commit is contained in:
silmeth
2019-02-05 22:48:33 +01:00
parent 30c8e477e4
commit 8621f3ff2b

View File

@@ -794,6 +794,11 @@ pub fn make_module(ctx: &PyContext) -> PyObjectRef {
ctx.exceptions.base_exception_type.clone(),
);
ctx.set_attr(&py_mod, "Exception", ctx.exceptions.exception_type.clone());
ctx.set_attr(
&py_mod,
"ArithmeticError",
ctx.exceptions.arithmetic_error.clone(),
);
ctx.set_attr(
&py_mod,
"AssertionError",
@@ -805,6 +810,11 @@ pub fn make_module(ctx: &PyContext) -> PyObjectRef {
ctx.exceptions.attribute_error.clone(),
);
ctx.set_attr(&py_mod, "NameError", ctx.exceptions.name_error.clone());
ctx.set_attr(
&py_mod,
"OverflowError",
ctx.exceptions.overflow_error.clone(),
);
ctx.set_attr(
&py_mod,
"RuntimeError",
@@ -819,6 +829,11 @@ pub fn make_module(ctx: &PyContext) -> PyObjectRef {
ctx.set_attr(&py_mod, "ValueError", ctx.exceptions.value_error.clone());
ctx.set_attr(&py_mod, "IndexError", ctx.exceptions.index_error.clone());
ctx.set_attr(&py_mod, "ImportError", ctx.exceptions.import_error.clone());
ctx.set_attr(
&py_mod,
"ZeroDivisionError",
ctx.exceptions.zero_division_error.clone(),
);
py_mod
}