summaryrefslogtreecommitdiff
path: root/py/objexcept.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-04-07 22:48:43 +1000
committerDamien George <damien.p.george@gmail.com>2020-04-09 16:09:38 +1000
commite292296d52800939e70513e33ec456518330c4ad (patch)
tree63111bc2adc3019c7942d61b7b69148f7b73b100 /py/objexcept.c
parent4914731e5831b289f7933e53cf34bdc79c7b7403 (diff)
py/objexcept: Remove optional TimeoutError exception.
TimeoutError was added back in 077812b2abe3f5e5325194f9694dad7eb38186dd for the cc3200 port. In f522849a4d5a978ac3d322d71a755f75d07e8ce6 the cc3200 port enabled use of it in the socket module aliased to socket.timeout. So it was never added to the builtins. Then it was replaced by OSError(ETIMEDOUT) in 047af9b10bfc6b0ec412f8450c6bec10ab95254b. The esp32 port enables this exception, since the very beginning of that port, but it could never be accessed because it's not in builtins. It's being removed: 1) to not encourage its use; 2) because there are a lot of other OSError subclasses which are not defined at all, and having TimeoutError is a bit inconsistent. Note that ports can add anything to the builtins via MICROPY_PORT_BUILTINS. And they can also define their own exceptions using the MP_DEFINE_EXCEPTION() macro.
Diffstat (limited to 'py/objexcept.c')
-rw-r--r--py/objexcept.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/py/objexcept.c b/py/objexcept.c
index 594c4c650..59a0557b1 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -303,9 +303,6 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
MP_DEFINE_EXCEPTION(UnboundLocalError, NameError)
*/
MP_DEFINE_EXCEPTION(OSError, Exception)
-#if MICROPY_PY_BUILTINS_TIMEOUTERROR
- MP_DEFINE_EXCEPTION(TimeoutError, OSError)
-#endif
/*
MP_DEFINE_EXCEPTION(BlockingIOError, OSError)
MP_DEFINE_EXCEPTION(ChildProcessError, OSError)
@@ -319,6 +316,7 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
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)