diff --git a/py/objexcept.c b/py/objexcept.c index 7fd783b3a4..de9bf1694f 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -107,23 +107,23 @@ MP_DEFINE_EXCEPTION(Exception, BaseException) MP_DEFINE_EXCEPTION_BASE(NameError) MP_DEFINE_EXCEPTION(UnboundLocalError, NameError) MP_DEFINE_EXCEPTION(OSError, Exception) + MP_DEFINE_EXCEPTION_BASE(OSError) // Probably don't need these - /*MP_DEFINE_EXCEPTION_BASE(OSError) - MP_DEFINE_EXCEPTION(BlockingIOError, OSError) + /*MP_DEFINE_EXCEPTION(BlockingIOError, OSError) MP_DEFINE_EXCEPTION(ChildProcessError, OSError) MP_DEFINE_EXCEPTION(ConnectionError, OSError) MP_DEFINE_EXCEPTION(BrokenPipeError, ConnectionError) MP_DEFINE_EXCEPTION(ConnectionAbortedError, ConnectionError) MP_DEFINE_EXCEPTION(ConnectionRefusedError, ConnectionError) MP_DEFINE_EXCEPTION(ConnectionResetError, ConnectionError) - MP_DEFINE_EXCEPTION(FileExistsError, OSError) - MP_DEFINE_EXCEPTION(FileNotFoundError, OSError) MP_DEFINE_EXCEPTION(InterruptedError, OSError) MP_DEFINE_EXCEPTION(IsADirectoryError, OSError) MP_DEFINE_EXCEPTION(NotADirectoryError, OSError) MP_DEFINE_EXCEPTION(PermissionError, OSError) MP_DEFINE_EXCEPTION(ProcessLookupError, OSError) MP_DEFINE_EXCEPTION(TimeoutError, OSError)*/ + MP_DEFINE_EXCEPTION(FileExistsError, OSError) + MP_DEFINE_EXCEPTION(FileNotFoundError, OSError) MP_DEFINE_EXCEPTION(ReferenceError, Exception) MP_DEFINE_EXCEPTION(RuntimeError, Exception) MP_DEFINE_EXCEPTION_BASE(RuntimeError) @@ -137,6 +137,7 @@ MP_DEFINE_EXCEPTION(Exception, BaseException) MP_DEFINE_EXCEPTION(TypeError, Exception) MP_DEFINE_EXCEPTION(ValueError, Exception) //TODO: Implement UnicodeErrors which take arguments + /* MP_DEFINE_EXCEPTION(Warning, Exception) MP_DEFINE_EXCEPTION_BASE(Warning) MP_DEFINE_EXCEPTION(DeprecationWarning, Warning) @@ -149,6 +150,7 @@ MP_DEFINE_EXCEPTION(Exception, BaseException) MP_DEFINE_EXCEPTION(UnicodeWarning, Warning) MP_DEFINE_EXCEPTION(BytesWarning, Warning) MP_DEFINE_EXCEPTION(ResourceWarning, Warning) + */ mp_obj_t mp_obj_new_exception(const mp_obj_type_t *exc_type) { return mp_obj_new_exception_msg_varg(exc_type, NULL); diff --git a/py/qstrdefs.h b/py/qstrdefs.h index b30177acf8..898e67582f 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -37,56 +37,33 @@ Q(BaseException) Q(ArithmeticError) Q(AssertionError) Q(AttributeError) -Q(BlockingIOError) -Q(BrokenPipeError) Q(BufferError) -Q(BytesWarning) -Q(ChildProcessError) -Q(ConnectionAbortedError) -Q(ConnectionError) -Q(ConnectionRefusedError) -Q(ConnectionResetError) -Q(DeprecationWarning) Q(EOFError) Q(EnvironmentError) Q(Exception) Q(FileExistsError) Q(FileNotFoundError) Q(FloatingPointError) -Q(FutureWarning) Q(GeneratorExit) Q(IOError) Q(ImportError) -Q(ImportWarning) Q(IndentationError) Q(IndexError) -Q(InterruptedError) -Q(IsADirectoryError) Q(KeyError) Q(LookupError) Q(MemoryError) Q(NameError) -Q(NotADirectoryError) Q(NotImplementedError) Q(OSError) Q(OverflowError) -Q(PendingDeprecationWarning) -Q(PermissionError) -Q(ProcessLookupError) Q(ReferenceError) -Q(ResourceWarning) Q(RuntimeError) -Q(RuntimeWarning) Q(SyntaxError) -Q(SyntaxWarning) Q(SystemError) Q(SystemExit) Q(TabError) -Q(TimeoutError) Q(TypeError) Q(UnboundLocalError) -Q(UnicodeWarning) -Q(UserWarning) Q(ValueError) Q(Warning) Q(ZeroDivisionError) diff --git a/py/runtime.c b/py/runtime.c index 03b662798e..3a613eaf23 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -149,17 +149,13 @@ STATIC const mp_builtin_elem_t builtin_table[] = { { MP_QSTR_AssertionError, (mp_obj_t)&mp_type_AssertionError }, { MP_QSTR_AttributeError, (mp_obj_t)&mp_type_AttributeError }, { MP_QSTR_BufferError, (mp_obj_t)&mp_type_BufferError }, - { MP_QSTR_BytesWarning, (mp_obj_t)&mp_type_BytesWarning }, - { MP_QSTR_DeprecationWarning, (mp_obj_t)&mp_type_DeprecationWarning }, { MP_QSTR_EOFError, (mp_obj_t)&mp_type_EOFError }, { MP_QSTR_EnvironmentError, (mp_obj_t)&mp_type_EnvironmentError }, { MP_QSTR_Exception, (mp_obj_t)&mp_type_Exception }, { MP_QSTR_FloatingPointError, (mp_obj_t)&mp_type_FloatingPointError }, - { MP_QSTR_FutureWarning, (mp_obj_t)&mp_type_FutureWarning }, { MP_QSTR_GeneratorExit, (mp_obj_t)&mp_type_GeneratorExit }, { MP_QSTR_IOError, (mp_obj_t)&mp_type_IOError }, { MP_QSTR_ImportError, (mp_obj_t)&mp_type_ImportError }, - { MP_QSTR_ImportWarning, (mp_obj_t)&mp_type_ImportWarning }, { MP_QSTR_IndentationError, (mp_obj_t)&mp_type_IndentationError }, { MP_QSTR_IndexError, (mp_obj_t)&mp_type_IndexError }, { MP_QSTR_KeyError, (mp_obj_t)&mp_type_KeyError }, @@ -169,21 +165,15 @@ STATIC const mp_builtin_elem_t builtin_table[] = { { MP_QSTR_NotImplementedError, (mp_obj_t)&mp_type_NotImplementedError }, { MP_QSTR_OSError, (mp_obj_t)&mp_type_OSError }, { MP_QSTR_OverflowError, (mp_obj_t)&mp_type_OverflowError }, - { MP_QSTR_PendingDeprecationWarning, (mp_obj_t)&mp_type_PendingDeprecationWarning }, { MP_QSTR_ReferenceError, (mp_obj_t)&mp_type_ReferenceError }, - { MP_QSTR_ResourceWarning, (mp_obj_t)&mp_type_ResourceWarning }, { MP_QSTR_RuntimeError, (mp_obj_t)&mp_type_RuntimeError }, - { MP_QSTR_RuntimeWarning, (mp_obj_t)&mp_type_RuntimeWarning }, { MP_QSTR_SyntaxError, (mp_obj_t)&mp_type_SyntaxError }, - { MP_QSTR_SyntaxWarning, (mp_obj_t)&mp_type_SyntaxWarning }, { MP_QSTR_SystemError, (mp_obj_t)&mp_type_SystemError }, { MP_QSTR_SystemExit, (mp_obj_t)&mp_type_SystemExit }, { MP_QSTR_TabError, (mp_obj_t)&mp_type_TabError }, { MP_QSTR_TypeError, (mp_obj_t)&mp_type_TypeError }, { MP_QSTR_UnboundLocalError, (mp_obj_t)&mp_type_UnboundLocalError }, - { MP_QSTR_UserWarning, (mp_obj_t)&mp_type_UserWarning }, { MP_QSTR_ValueError, (mp_obj_t)&mp_type_ValueError }, - { MP_QSTR_Warning, (mp_obj_t)&mp_type_Warning }, { MP_QSTR_ZeroDivisionError, (mp_obj_t)&mp_type_ZeroDivisionError }, { MP_QSTR_StopIteration, (mp_obj_t)&mp_type_StopIteration }, // Somehow CPython managed to have OverflowError not inherit from ValueError ;-/