@@ -354,10 +354,26 @@ pub fn make_module(ctx: &PyContext) -> PyObjectRef {
354354 dict. insert ( String :: from ( "tuple" ) , ctx. tuple_type . clone ( ) ) ;
355355 dict. insert ( String :: from ( "type" ) , ctx. type_type . clone ( ) ) ;
356356 dict. insert ( String :: from ( "object" ) , ctx. object . clone ( ) ) ;
357+
358+ // Exceptions:
357359 dict. insert (
358360 String :: from ( "BaseException" ) ,
359361 ctx. base_exception_type . clone ( ) ,
360362 ) ;
363+ let exception_type = ctx. new_class ( & String :: from ( "Exception" ) , ctx. base_exception_type . clone ( ) ) ;
364+ dict. insert ( String :: from ( "Exception" ) , exception_type. clone ( ) ) ;
365+ let assertion_error = ctx. new_class ( & String :: from ( "AssertionError" ) , exception_type. clone ( ) ) ;
366+ dict. insert ( String :: from ( "AssertionError" ) , assertion_error) ;
367+ let attribute_error = ctx. new_class ( & String :: from ( "AttributeError" ) , exception_type. clone ( ) ) ;
368+ dict. insert ( String :: from ( "AttributeError" ) , attribute_error) ;
369+ let name_error = ctx. new_class ( & String :: from ( "NameError" ) , exception_type. clone ( ) ) ;
370+ dict. insert ( String :: from ( "NameError" ) , name_error) ;
371+ let runtime_error = ctx. new_class ( & String :: from ( "RuntimeError" ) , exception_type. clone ( ) ) ;
372+ dict. insert ( String :: from ( "RuntimeError" ) , runtime_error. clone ( ) ) ;
373+ let not_implemented_error =
374+ ctx. new_class ( & String :: from ( "NotImplementedError" ) , runtime_error. clone ( ) ) ;
375+ dict. insert ( String :: from ( "NotImplementedError" ) , not_implemented_error) ;
376+
361377 let d2 = PyObject :: new ( PyObjectKind :: Dict { elements : dict } , ctx. type_type . clone ( ) ) ;
362378 let scope = PyObject :: new (
363379 PyObjectKind :: Scope {
0 commit comments