diff options
| author | Roy Hooper <rhooper@toybox.ca> | 2018-05-15 14:54:54 -0400 |
|---|---|---|
| committer | Roy Hooper <rhooper@toybox.ca> | 2018-05-15 14:54:54 -0400 |
| commit | 90a09dba59e1e735ee463155527eee0c4026a98a (patch) | |
| tree | 375430b810eef5c7a64a93c3cc678643be54e8b4 /py | |
| parent | 9f2026158b8a2d99ac41d1ee6a894db40d508718 (diff) | |
| parent | 54293397c5736e7e571a933c92dccf375d529b2b (diff) | |
Merge branch 'master' of github.com:adafruit/circuitpython
Diffstat (limited to 'py')
| -rw-r--r-- | py/modcollections.c | 2 | ||||
| -rw-r--r-- | py/moduerrno.c | 14 | ||||
| -rw-r--r-- | py/objmodule.c | 2 |
3 files changed, 16 insertions, 2 deletions
diff --git a/py/modcollections.c b/py/modcollections.c index 1a1560387..837ec2f92 100644 --- a/py/modcollections.c +++ b/py/modcollections.c @@ -29,7 +29,7 @@ #if MICROPY_PY_COLLECTIONS STATIC const mp_rom_map_elem_t mp_module_collections_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ucollections) }, + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_collections) }, { MP_ROM_QSTR(MP_QSTR_namedtuple), MP_ROM_PTR(&mp_namedtuple_obj) }, #if MICROPY_PY_COLLECTIONS_ORDEREDDICT { MP_ROM_QSTR(MP_QSTR_OrderedDict), MP_ROM_PTR(&mp_type_ordereddict) }, diff --git a/py/moduerrno.c b/py/moduerrno.c index de66c941b..ce8a6bf89 100644 --- a/py/moduerrno.c +++ b/py/moduerrno.c @@ -100,6 +100,20 @@ const mp_obj_module_t mp_module_uerrno = { }; qstr mp_errno_to_str(mp_obj_t errno_val) { + // For commonly encountered errors, return human readable strings + if (MP_OBJ_IS_SMALL_INT(errno_val)) { + switch (MP_OBJ_SMALL_INT_VALUE(errno_val)) { + case EPERM: return MP_QSTR_Permission_space_denied; + case ENOENT: return MP_QSTR_No_space_such_space_file_slash_directory; + case EIO: return MP_QSTR_Input_slash_output_space_error; + case EACCES: return MP_QSTR_Permission_space_denied; + case EEXIST: return MP_QSTR_File_space_exists; + case ENODEV: return MP_QSTR_Unsupported_space_operation; + case EINVAL: return MP_QSTR_Invalid_space_argument; + } + } + + // Otherwise, return the Exxxx string for that error code #if MICROPY_PY_UERRNO_ERRORCODE // We have the errorcode dict so can do a lookup using the hash map mp_map_elem_t *elem = mp_map_lookup((mp_map_t*)&errorcode_dict.map, errno_val, MP_MAP_LOOKUP); diff --git a/py/objmodule.c b/py/objmodule.c index 3bea19644..e3464ecfa 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -151,7 +151,7 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = { { MP_ROM_QSTR(MP_QSTR_uio), MP_ROM_PTR(&mp_module_io) }, #endif #if MICROPY_PY_COLLECTIONS - { MP_ROM_QSTR(MP_QSTR_ucollections), MP_ROM_PTR(&mp_module_collections) }, + { MP_ROM_QSTR(MP_QSTR_collections), MP_ROM_PTR(&mp_module_collections) }, #endif #if MICROPY_PY_STRUCT { MP_ROM_QSTR(MP_QSTR_ustruct), MP_ROM_PTR(&mp_module_ustruct) }, |
