diff --git a/py/builtintables.c b/py/builtintables.c index 7b35207fa552f51b3c39e16b9725607a5c38a0b7..5712a3ef568356c6f88ea884b788bff440f6322d 100644 --- a/py/builtintables.c +++ b/py/builtintables.c @@ -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 }, diff --git a/py/obj.h b/py/obj.h index d96e4ec751b6cbe77ce510e1411e93863e22e146..0156286818b0addff7a37f227f41913490ab7afd 100644 --- a/py/obj.h +++ b/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; diff --git a/py/objexcept.c b/py/objexcept.c index 7f0736543a63ff2a0d136dfee67f4a5854c8a9b1..9b22acd995cf90d068f22a3ec6f0e0490a0c37a7 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -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) diff --git a/py/qstrdefs.h b/py/qstrdefs.h index fda140f11f4b865e181e8341417e364a9d44f892..6a63f0780b93170a85577bf3f354fb32774d2e84 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -105,7 +105,6 @@ Q(FileExistsError) Q(FileNotFoundError) Q(FloatingPointError) Q(GeneratorExit) -Q(IOError) Q(ImportError) Q(IndentationError) Q(IndexError) diff --git a/stmhal/modselect.c b/stmhal/modselect.c index a84c94554c6c2475ef41854efa72d1ad0314ee17..ff9df8f5ec5c35f2b1f57f35667830dce704fc9d 100644 --- a/stmhal/modselect.c +++ b/stmhal/modselect.c @@ -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; diff --git a/tests/basics/exceptpoly.py b/tests/basics/exceptpoly.py index 599a72b2a2d9602316ee68dab8e3fee091c35441..2dc68c13b578f95a4ea5db3e101055b27d3f40b6 100644 --- a/tests/basics/exceptpoly.py +++ b/tests/basics/exceptpoly.py @@ -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