Commit 8b03d944 authored by Damien George's avatar Damien George
Browse files

py: Remove IOError since it's deprecated; use OSError instead.

In CPython IOError (and EnvironmentError) is deprecated and aliased to
OSError.  All modules that used to raise IOError now raise OSError (or a
derived exception).

In Micro Python we never used IOError (except 1 place, incorrectly) and
so don't need to keep it.

See http://legacy.python.org/dev/peps/pep-3151/ for background.
parent 1c6a1dc7
...@@ -123,7 +123,6 @@ STATIC const mp_map_elem_t mp_builtin_object_table[] = { ...@@ -123,7 +123,6 @@ STATIC const mp_map_elem_t mp_builtin_object_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_EOFError), (mp_obj_t)&mp_type_EOFError }, { MP_OBJ_NEW_QSTR(MP_QSTR_EOFError), (mp_obj_t)&mp_type_EOFError },
{ MP_OBJ_NEW_QSTR(MP_QSTR_Exception), (mp_obj_t)&mp_type_Exception }, { MP_OBJ_NEW_QSTR(MP_QSTR_Exception), (mp_obj_t)&mp_type_Exception },
{ MP_OBJ_NEW_QSTR(MP_QSTR_GeneratorExit), (mp_obj_t)&mp_type_GeneratorExit }, { MP_OBJ_NEW_QSTR(MP_QSTR_GeneratorExit), (mp_obj_t)&mp_type_GeneratorExit },
{ MP_OBJ_NEW_QSTR(MP_QSTR_IOError), (mp_obj_t)&mp_type_IOError },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ImportError), (mp_obj_t)&mp_type_ImportError }, { MP_OBJ_NEW_QSTR(MP_QSTR_ImportError), (mp_obj_t)&mp_type_ImportError },
{ MP_OBJ_NEW_QSTR(MP_QSTR_IndentationError), (mp_obj_t)&mp_type_IndentationError }, { MP_OBJ_NEW_QSTR(MP_QSTR_IndentationError), (mp_obj_t)&mp_type_IndentationError },
{ MP_OBJ_NEW_QSTR(MP_QSTR_IndexError), (mp_obj_t)&mp_type_IndexError }, { MP_OBJ_NEW_QSTR(MP_QSTR_IndexError), (mp_obj_t)&mp_type_IndexError },
......
...@@ -326,7 +326,6 @@ extern const mp_obj_type_t mp_type_AttributeError; ...@@ -326,7 +326,6 @@ extern const mp_obj_type_t mp_type_AttributeError;
extern const mp_obj_type_t mp_type_EOFError; extern const mp_obj_type_t mp_type_EOFError;
extern const mp_obj_type_t mp_type_Exception; extern const mp_obj_type_t mp_type_Exception;
extern const mp_obj_type_t mp_type_GeneratorExit; 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_ImportError;
extern const mp_obj_type_t mp_type_IndentationError; 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_IndexError;
......
...@@ -224,10 +224,10 @@ MP_DEFINE_EXCEPTION(Exception, BaseException) ...@@ -224,10 +224,10 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
MP_DEFINE_EXCEPTION(AssertionError, Exception) MP_DEFINE_EXCEPTION(AssertionError, Exception)
MP_DEFINE_EXCEPTION(AttributeError, Exception) MP_DEFINE_EXCEPTION(AttributeError, Exception)
//MP_DEFINE_EXCEPTION(BufferError, Exception) //MP_DEFINE_EXCEPTION(BufferError, Exception)
//MP_DEFINE_EXCEPTION(EnvironmentError, Exception) //MP_DEFINE_EXCEPTION(EnvironmentError, Exception) use OSError instead
MP_DEFINE_EXCEPTION(EOFError, Exception) MP_DEFINE_EXCEPTION(EOFError, Exception)
MP_DEFINE_EXCEPTION(ImportError, Exception) MP_DEFINE_EXCEPTION(ImportError, Exception)
MP_DEFINE_EXCEPTION(IOError, Exception) //MP_DEFINE_EXCEPTION(IOError, Exception) use OSError instead
MP_DEFINE_EXCEPTION(LookupError, Exception) MP_DEFINE_EXCEPTION(LookupError, Exception)
MP_DEFINE_EXCEPTION_BASE(LookupError) MP_DEFINE_EXCEPTION_BASE(LookupError)
MP_DEFINE_EXCEPTION(IndexError, LookupError) MP_DEFINE_EXCEPTION(IndexError, LookupError)
......
...@@ -105,7 +105,6 @@ Q(FileExistsError) ...@@ -105,7 +105,6 @@ Q(FileExistsError)
Q(FileNotFoundError) Q(FileNotFoundError)
Q(FloatingPointError) Q(FloatingPointError)
Q(GeneratorExit) Q(GeneratorExit)
Q(IOError)
Q(ImportError) Q(ImportError)
Q(IndentationError) Q(IndentationError)
Q(IndexError) Q(IndexError)
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h>
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
...@@ -213,7 +214,7 @@ STATIC mp_obj_t poll_modify(mp_obj_t self_in, mp_obj_t obj_in, mp_obj_t eventmas ...@@ -213,7 +214,7 @@ STATIC mp_obj_t poll_modify(mp_obj_t self_in, mp_obj_t obj_in, mp_obj_t eventmas
mp_obj_poll_t *self = self_in; mp_obj_poll_t *self = self_in;
mp_map_elem_t *elem = mp_map_lookup(&self->poll_map, mp_obj_id(obj_in), MP_MAP_LOOKUP); mp_map_elem_t *elem = mp_map_lookup(&self->poll_map, mp_obj_id(obj_in), MP_MAP_LOOKUP);
if (elem == NULL) { if (elem == NULL) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_IOError, "object was never registered")); nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENOENT)));
} }
((poll_obj_t*)elem->value)->flags = mp_obj_get_int(eventmask_in); ((poll_obj_t*)elem->value)->flags = mp_obj_get_int(eventmask_in);
return mp_const_none; return mp_const_none;
......
...@@ -108,15 +108,15 @@ except Exception: ...@@ -108,15 +108,15 @@ except Exception:
#except FutureWarning: #except FutureWarning:
# print("Caught FutureWarning") # print("Caught FutureWarning")
try: #try:
raise IOError # raise IOError
except Exception: #except Exception:
print("Caught IOError via Exception") # print("Caught IOError via Exception")
try: #try:
raise IOError # raise IOError
except IOError: #except IOError:
print("Caught IOError") # print("Caught IOError")
try: try:
raise ImportError raise ImportError
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment