summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--py/builtintables.c6
-rw-r--r--py/obj.h34
-rw-r--r--py/objexcept.c8
-rw-r--r--py/qstrdefs.h5
-rw-r--r--tests/basics/exceptpoly.py208
5 files changed, 110 insertions, 151 deletions
diff --git a/py/builtintables.c b/py/builtintables.c
index e9c1bcab2d..0aa0b66a72 100644
--- a/py/builtintables.c
+++ b/py/builtintables.c
@@ -85,7 +85,6 @@ STATIC const mp_builtin_elem_t builtin_object_table[] = {
{ MP_QSTR_AttributeError, (mp_obj_t)&mp_type_AttributeError },
{ MP_QSTR_BufferError, (mp_obj_t)&mp_type_BufferError },
{ 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_GeneratorExit, (mp_obj_t)&mp_type_GeneratorExit },
@@ -100,17 +99,14 @@ STATIC const mp_builtin_elem_t builtin_object_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_ReferenceError, (mp_obj_t)&mp_type_ReferenceError },
{ MP_QSTR_RuntimeError, (mp_obj_t)&mp_type_RuntimeError },
+ { MP_QSTR_StopIteration, (mp_obj_t)&mp_type_StopIteration },
{ MP_QSTR_SyntaxError, (mp_obj_t)&mp_type_SyntaxError },
{ 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_ValueError, (mp_obj_t)&mp_type_ValueError },
{ 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 ;-/
// TODO: For MICROPY_CPYTHON_COMPAT==0 use ValueError to avoid exc proliferation
diff --git a/py/obj.h b/py/obj.h
index d4f9144ea8..b52b5a0c7e 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -191,17 +191,12 @@ extern const mp_obj_type_t mp_type_ArithmeticError;
extern const mp_obj_type_t mp_type_AssertionError;
extern const mp_obj_type_t mp_type_AttributeError;
extern const mp_obj_type_t mp_type_BufferError;
-extern const mp_obj_type_t mp_type_BytesWarning;
-extern const mp_obj_type_t mp_type_DeprecationWarning;
extern const mp_obj_type_t mp_type_EOFError;
-extern const mp_obj_type_t mp_type_EnvironmentError;
extern const mp_obj_type_t mp_type_Exception;
extern const mp_obj_type_t mp_type_FloatingPointError;
-extern const mp_obj_type_t mp_type_FutureWarning;
extern const mp_obj_type_t mp_type_GeneratorExit;
extern const mp_obj_type_t mp_type_IOError;
extern const mp_obj_type_t mp_type_ImportError;
-extern const mp_obj_type_t mp_type_ImportWarning;
extern const mp_obj_type_t mp_type_IndentationError;
extern const mp_obj_type_t mp_type_IndexError;
extern const mp_obj_type_t mp_type_KeyError;
@@ -211,43 +206,16 @@ extern const mp_obj_type_t mp_type_NameError;
extern const mp_obj_type_t mp_type_NotImplementedError;
extern const mp_obj_type_t mp_type_OSError;
extern const mp_obj_type_t mp_type_OverflowError;
-extern const mp_obj_type_t mp_type_PendingDeprecationWarning;
-extern const mp_obj_type_t mp_type_ReferenceError;
-extern const mp_obj_type_t mp_type_ResourceWarning;
extern const mp_obj_type_t mp_type_RuntimeError;
-extern const mp_obj_type_t mp_type_RuntimeWarning;
+extern const mp_obj_type_t mp_type_StopIteration;
extern const mp_obj_type_t mp_type_SyntaxError;
-extern const mp_obj_type_t mp_type_SyntaxWarning;
extern const mp_obj_type_t mp_type_SystemError;
-extern const mp_obj_type_t mp_type_SystemExit;
-extern const mp_obj_type_t mp_type_TabError;
extern const mp_obj_type_t mp_type_TypeError;
extern const mp_obj_type_t mp_type_UnboundLocalError;
-extern const mp_obj_type_t mp_type_UserWarning;
extern const mp_obj_type_t mp_type_ValueError;
-extern const mp_obj_type_t mp_type_Warning;
extern const mp_obj_type_t mp_type_ZeroDivisionError;
-extern const mp_obj_type_t mp_type_StopIteration;
-/*extern const mp_obj_type_t mp_type_BaseException;
-extern const mp_obj_type_t mp_type_AssertionError;
-extern const mp_obj_type_t mp_type_AttributeError;
-extern const mp_obj_type_t mp_type_ImportError;
-extern const mp_obj_type_t mp_type_IndentationError;
-extern const mp_obj_type_t mp_type_IndexError;
-extern const mp_obj_type_t mp_type_KeyError;
-extern const mp_obj_type_t mp_type_NameError;
-extern const mp_obj_type_t mp_type_SyntaxError;
-extern const mp_obj_type_t mp_type_TypeError;
-extern const mp_obj_type_t mp_type_ValueError;
-extern const mp_obj_type_t mp_type_OverflowError;
-extern const mp_obj_type_t mp_type_OSError;
-extern const mp_obj_type_t mp_type_NotImplementedError;
-extern const mp_obj_type_t mp_type_StopIteration;
-extern const mp_obj_type_t mp_type_ZeroDivisionError;*/
-
// Constant objects, globally accessible
-
extern const mp_obj_t mp_const_none;
extern const mp_obj_t mp_const_false;
extern const mp_obj_t mp_const_true;
diff --git a/py/objexcept.c b/py/objexcept.c
index 102450d277..0650920e7d 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -96,7 +96,7 @@ const mp_obj_type_t mp_type_ ## exc_name = { \
// List of all exceptions, arranged as in the table at:
// http://docs.python.org/3.3/library/exceptions.html
MP_DEFINE_EXCEPTION_BASE(BaseException)
-MP_DEFINE_EXCEPTION(SystemExit, BaseException)
+//MP_DEFINE_EXCEPTION(SystemExit, BaseException)
//MP_DEFINE_EXCEPTION(KeyboardInterrupt, BaseException)
MP_DEFINE_EXCEPTION(GeneratorExit, BaseException)
MP_DEFINE_EXCEPTION(Exception, BaseException)
@@ -110,7 +110,7 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
MP_DEFINE_EXCEPTION(AssertionError, Exception)
MP_DEFINE_EXCEPTION(AttributeError, Exception)
MP_DEFINE_EXCEPTION(BufferError, Exception)
- MP_DEFINE_EXCEPTION(EnvironmentError, Exception)
+ //MP_DEFINE_EXCEPTION(EnvironmentError, Exception)
MP_DEFINE_EXCEPTION(EOFError, Exception)
MP_DEFINE_EXCEPTION(ImportError, Exception)
MP_DEFINE_EXCEPTION(IOError, Exception)
@@ -140,7 +140,7 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
MP_DEFINE_EXCEPTION(TimeoutError, OSError)*/
MP_DEFINE_EXCEPTION(FileExistsError, OSError)
MP_DEFINE_EXCEPTION(FileNotFoundError, OSError)
- MP_DEFINE_EXCEPTION(ReferenceError, Exception)
+ //MP_DEFINE_EXCEPTION(ReferenceError, Exception)
MP_DEFINE_EXCEPTION(RuntimeError, Exception)
MP_DEFINE_EXCEPTION_BASE(RuntimeError)
MP_DEFINE_EXCEPTION(NotImplementedError, RuntimeError)
@@ -148,7 +148,7 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
MP_DEFINE_EXCEPTION_BASE(SyntaxError)
MP_DEFINE_EXCEPTION(IndentationError, SyntaxError)
MP_DEFINE_EXCEPTION_BASE(IndentationError)
- MP_DEFINE_EXCEPTION(TabError, IndentationError)
+ //MP_DEFINE_EXCEPTION(TabError, IndentationError)
MP_DEFINE_EXCEPTION(SystemError, Exception)
MP_DEFINE_EXCEPTION(TypeError, Exception)
MP_DEFINE_EXCEPTION(ValueError, Exception)
diff --git a/py/qstrdefs.h b/py/qstrdefs.h
index f96921acf7..44c61002a6 100644
--- a/py/qstrdefs.h
+++ b/py/qstrdefs.h
@@ -39,7 +39,6 @@ Q(AssertionError)
Q(AttributeError)
Q(BufferError)
Q(EOFError)
-Q(EnvironmentError)
Q(Exception)
Q(FileExistsError)
Q(FileNotFoundError)
@@ -56,16 +55,12 @@ Q(NameError)
Q(NotImplementedError)
Q(OSError)
Q(OverflowError)
-Q(ReferenceError)
Q(RuntimeError)
Q(SyntaxError)
Q(SystemError)
-Q(SystemExit)
-Q(TabError)
Q(TypeError)
Q(UnboundLocalError)
Q(ValueError)
-Q(Warning)
Q(ZeroDivisionError)
Q(None)
diff --git a/tests/basics/exceptpoly.py b/tests/basics/exceptpoly.py
index 0e5ac2d1a3..b2fc11afbe 100644
--- a/tests/basics/exceptpoly.py
+++ b/tests/basics/exceptpoly.py
@@ -38,25 +38,25 @@ try:
except BufferError:
print("Caught BufferError")
-try:
- raise BytesWarning
-except Warning:
- print("Caught BytesWarning via Warning")
+#try:
+# raise BytesWarning
+#except Warning:
+# print("Caught BytesWarning via Warning")
-try:
- raise BytesWarning
-except BytesWarning:
- print("Caught BytesWarning")
+#try:
+# raise BytesWarning
+#except BytesWarning:
+# print("Caught BytesWarning")
-try:
- raise DeprecationWarning
-except Warning:
- print("Caught DeprecationWarning via Warning")
+#try:
+# raise DeprecationWarning
+#except Warning:
+# print("Caught DeprecationWarning via Warning")
-try:
- raise DeprecationWarning
-except DeprecationWarning:
- print("Caught DeprecationWarning")
+#try:
+# raise DeprecationWarning
+#except DeprecationWarning:
+# print("Caught DeprecationWarning")
try:
raise EOFError
@@ -68,15 +68,15 @@ try:
except EOFError:
print("Caught EOFError")
-try:
- raise EnvironmentError
-except Exception:
- print("Caught EnvironmentError via Exception")
+#try:
+# raise EnvironmentError
+#except Exception:
+# print("Caught EnvironmentError via Exception")
-try:
- raise EnvironmentError
-except EnvironmentError:
- print("Caught EnvironmentError")
+#try:
+# raise EnvironmentError
+#except EnvironmentError:
+# print("Caught EnvironmentError")
try:
raise Exception
@@ -98,15 +98,15 @@ try:
except FloatingPointError:
print("Caught FloatingPointError")
-try:
- raise FutureWarning
-except Warning:
- print("Caught FutureWarning via Warning")
+#try:
+# raise FutureWarning
+#except Warning:
+# print("Caught FutureWarning via Warning")
-try:
- raise FutureWarning
-except FutureWarning:
- print("Caught FutureWarning")
+#try:
+# raise FutureWarning
+#except FutureWarning:
+# print("Caught FutureWarning")
try:
raise IOError
@@ -128,15 +128,15 @@ try:
except ImportError:
print("Caught ImportError")
-try:
- raise ImportWarning
-except Warning:
- print("Caught ImportWarning via Warning")
+#try:
+# raise ImportWarning
+#except Warning:
+# print("Caught ImportWarning via Warning")
-try:
- raise ImportWarning
-except ImportWarning:
- print("Caught ImportWarning")
+#try:
+# raise ImportWarning
+#except ImportWarning:
+# print("Caught ImportWarning")
try:
raise IndentationError
@@ -228,35 +228,35 @@ try:
except OverflowError:
print("Caught OverflowError")
-try:
- raise PendingDeprecationWarning
-except Warning:
- print("Caught PendingDeprecationWarning via Warning")
+#try:
+# raise PendingDeprecationWarning
+#except Warning:
+# print("Caught PendingDeprecationWarning via Warning")
-try:
- raise PendingDeprecationWarning
-except PendingDeprecationWarning:
- print("Caught PendingDeprecationWarning")
+#try:
+# raise PendingDeprecationWarning
+#except PendingDeprecationWarning:
+# print("Caught PendingDeprecationWarning")
-try:
- raise ReferenceError
-except Exception:
- print("Caught ReferenceError via Exception")
+#try:
+# raise ReferenceError
+#except Exception:
+# print("Caught ReferenceError via Exception")
-try:
- raise ReferenceError
-except ReferenceError:
- print("Caught ReferenceError")
+#try:
+# raise ReferenceError
+#except ReferenceError:
+# print("Caught ReferenceError")
-try:
- raise ResourceWarning
-except Warning:
- print("Caught ResourceWarning via Warning")
+#try:
+# raise ResourceWarning
+#except Warning:
+# print("Caught ResourceWarning via Warning")
-try:
- raise ResourceWarning
-except ResourceWarning:
- print("Caught ResourceWarning")
+#try:
+# raise ResourceWarning
+#except ResourceWarning:
+# print("Caught ResourceWarning")
try:
raise RuntimeError
@@ -268,15 +268,15 @@ try:
except RuntimeError:
print("Caught RuntimeError")
-try:
- raise RuntimeWarning
-except Warning:
- print("Caught RuntimeWarning via Warning")
+#try:
+# raise RuntimeWarning
+#except Warning:
+# print("Caught RuntimeWarning via Warning")
-try:
- raise RuntimeWarning
-except RuntimeWarning:
- print("Caught RuntimeWarning")
+#try:
+# raise RuntimeWarning
+#except RuntimeWarning:
+# print("Caught RuntimeWarning")
try:
raise SyntaxError
@@ -288,15 +288,15 @@ try:
except SyntaxError:
print("Caught SyntaxError")
-try:
- raise SyntaxWarning
-except Warning:
- print("Caught SyntaxWarning via Warning")
+#try:
+# raise SyntaxWarning
+#except Warning:
+# print("Caught SyntaxWarning via Warning")
-try:
- raise SyntaxWarning
-except SyntaxWarning:
- print("Caught SyntaxWarning")
+#try:
+# raise SyntaxWarning
+#except SyntaxWarning:
+# print("Caught SyntaxWarning")
try:
raise SystemError
@@ -308,15 +308,15 @@ try:
except SystemError:
print("Caught SystemError")
-try:
- raise TabError
-except IndentationError:
- print("Caught TabError via IndentationError")
+#try:
+# raise TabError
+#except IndentationError:
+# print("Caught TabError via IndentationError")
-try:
- raise TabError
-except TabError:
- print("Caught TabError")
+#try:
+# raise TabError
+#except TabError:
+# print("Caught TabError")
try:
raise TypeError
@@ -338,15 +338,15 @@ try:
except UnboundLocalError:
print("Caught UnboundLocalError")
-try:
- raise UserWarning
-except Warning:
- print("Caught UserWarning via Warning")
+#try:
+# raise UserWarning
+#except Warning:
+# print("Caught UserWarning via Warning")
-try:
- raise UserWarning
-except UserWarning:
- print("Caught UserWarning")
+#try:
+# raise UserWarning
+#except UserWarning:
+# print("Caught UserWarning")
try:
raise ValueError
@@ -358,15 +358,15 @@ try:
except ValueError:
print("Caught ValueError")
-try:
- raise Warning
-except Exception:
- print("Caught Warning via Exception")
+#try:
+# raise Warning
+#except Exception:
+# print("Caught Warning via Exception")
-try:
- raise Warning
-except Warning:
- print("Caught Warning")
+#try:
+# raise Warning
+#except Warning:
+# print("Caught Warning")
try:
raise ZeroDivisionError