diff --git a/docs/library/errno.rst b/docs/library/errno.rst index def01362f1..1f2c7e14ea 100644 --- a/docs/library/errno.rst +++ b/docs/library/errno.rst @@ -1,10 +1,10 @@ -:mod:`uerrno` -- system error codes +:mod:`errno` -- system error codes =================================== -.. module:: uerrno +.. module:: errno :synopsis: system error codes -|see_cpython_module| :mod:`python:errno`. +|see_cpython_module| :mod:`cpython:errno`. This module provides access to symbolic error codes for `OSError` exception. A particular inventory of codes depends on :term:`MicroPython port`. @@ -20,9 +20,9 @@ Constants where ``exc`` is an instance of `OSError`. Usage example:: try: - uos.mkdir("my_dir") + os.mkdir("my_dir") except OSError as exc: - if exc.args[0] == uerrno.EEXIST: + if exc.args[0] == errno.EEXIST: print("Directory already exists") .. data:: errorcode @@ -30,5 +30,5 @@ Constants Dictionary mapping numeric error codes to strings with symbolic error code (see above):: - >>> print(uerrno.errorcode[uerrno.EEXIST]) + >>> print(errno.errorcode[errno.EEXIST]) EEXIST diff --git a/py/argcheck.c b/py/argcheck.c index e26d6114ba..553724d31f 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -52,8 +52,7 @@ void mp_arg_check_num_sig(size_t n_args, size_t n_kw, uint32_t sig) { #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); #else - mp_raise_msg_varg(&mp_type_TypeError, - MP_ERROR_TEXT("function takes %d positional arguments but %d were given"), + mp_raise_TypeError_varg(MP_ERROR_TEXT("function takes %d positional arguments but %d were given"), n_args_min, n_args); #endif } @@ -62,7 +61,7 @@ void mp_arg_check_num_sig(size_t n_args, size_t n_kw, uint32_t sig) { #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); #else - mp_raise_msg_varg(&mp_type_TypeError, + mp_raise_TypeError_varg( MP_ERROR_TEXT("function missing %d required positional arguments"), n_args_min - n_args); #endif @@ -70,7 +69,7 @@ void mp_arg_check_num_sig(size_t n_args, size_t n_kw, uint32_t sig) { #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); #else - mp_raise_msg_varg(&mp_type_TypeError, + mp_raise_TypeError_varg( MP_ERROR_TEXT("function expected at most %d arguments, got %d"), n_args_max, n_args); #endif @@ -107,7 +106,7 @@ void mp_arg_parse_all(size_t n_pos, const mp_obj_t *pos, mp_map_t *kws, size_t n #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); #else - mp_raise_msg_varg(&mp_type_TypeError, MP_ERROR_TEXT("'%q' argument required"), allowed[i].qst); + mp_raise_TypeError_varg(MP_ERROR_TEXT("'%q' argument required"), allowed[i].qst); #endif } out_vals[i] = allowed[i].defval; diff --git a/py/objtuple.c b/py/objtuple.c index c16212d7ac..bb4f79997c 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -37,9 +37,6 @@ // type check is done on getiter method to allow tuple, namedtuple, attrtuple #define mp_obj_is_tuple_compatible(o) (mp_obj_get_type(o)->getiter == mp_obj_tuple_getiter) -// type check is done on getiter method to allow tuple, namedtuple, attrtuple -#define mp_obj_is_tuple_compatible(o) (mp_obj_get_type(o)->getiter == mp_obj_tuple_getiter) - /******************************************************************************/ /* tuple */ diff --git a/tests/extmod/vfs_fat_finaliser.py b/tests/extmod/vfs_fat_finaliser.py index e30f42f847..b4ec8f89d2 100644 --- a/tests/extmod/vfs_fat_finaliser.py +++ b/tests/extmod/vfs_fat_finaliser.py @@ -62,7 +62,7 @@ for i in range(N): f = vfs.open(n, "w") f.write(n) f = None # release f without closing - [0, 1, 2, 3] # use up Python stack so f is really gone + [0, 1, 2, 3, 4, 5] # use up Python stack so f is really gone gc.collect() # should finalise all N files by closing them for i in range(N): with vfs.open("x%d" % i, "r") as f: