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.
This commit is contained in:
parent
1c6a1dc740
commit
8b03d944e2
@ -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_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_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_IndentationError), (mp_obj_t)&mp_type_IndentationError },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_IndexError), (mp_obj_t)&mp_type_IndexError },
|
||||
|
1
py/obj.h
1
py/obj.h
@ -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_Exception;
|
||||
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_IndentationError;
|
||||
extern const mp_obj_type_t mp_type_IndexError;
|
||||
|
@ -224,10 +224,10 @@ 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) use OSError instead
|
||||
MP_DEFINE_EXCEPTION(EOFError, 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_BASE(LookupError)
|
||||
MP_DEFINE_EXCEPTION(IndexError, LookupError)
|
||||
|
@ -105,7 +105,6 @@ Q(FileExistsError)
|
||||
Q(FileNotFoundError)
|
||||
Q(FloatingPointError)
|
||||
Q(GeneratorExit)
|
||||
Q(IOError)
|
||||
Q(ImportError)
|
||||
Q(IndentationError)
|
||||
Q(IndexError)
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.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
|
||||
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);
|
||||
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);
|
||||
return mp_const_none;
|
||||
|
@ -108,15 +108,15 @@ except Exception:
|
||||
#except FutureWarning:
|
||||
# print("Caught FutureWarning")
|
||||
|
||||
try:
|
||||
raise IOError
|
||||
except Exception:
|
||||
print("Caught IOError via Exception")
|
||||
#try:
|
||||
# raise IOError
|
||||
#except Exception:
|
||||
# print("Caught IOError via Exception")
|
||||
|
||||
try:
|
||||
raise IOError
|
||||
except IOError:
|
||||
print("Caught IOError")
|
||||
#try:
|
||||
# raise IOError
|
||||
#except IOError:
|
||||
# print("Caught IOError")
|
||||
|
||||
try:
|
||||
raise ImportError
|
||||
|
Loading…
x
Reference in New Issue
Block a user