diff options
| author | Dan Halbert <halbert@adafruit.com> | 2020-02-04 18:41:17 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-04 18:41:17 -0500 |
| commit | 433671f5eb1e4ac94615301c3b41c6a01935274a (patch) | |
| tree | d94265500bd28047df73346068a42787b9050292 /py/runtime.c | |
| parent | 65045eb3bc4c61a5e4c538cdbf93b97f832f251e (diff) | |
| parent | 280e20adbeba23711bef3786e1bb1c7bbc87c825 (diff) | |
Merge pull request #2584 from dhalbert/oserror-with-filename5.0.0-beta.5
Include filename for 'No such file/directory', etc.
Diffstat (limited to 'py/runtime.c')
| -rw-r--r-- | py/runtime.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c index 48416bab2..c1c311ae4 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -29,10 +29,12 @@ #include <string.h> #include <assert.h> + #include "extmod/vfs.h" #include "py/parsenum.h" #include "py/compile.h" +#include "py/mperrno.h" #include "py/objstr.h" #include "py/objtuple.h" #include "py/objtype.h" @@ -1576,6 +1578,14 @@ NORETURN void mp_raise_OSError_msg(const compressed_string_t *msg) { mp_raise_msg(&mp_type_OSError, msg); } +NORETURN void mp_raise_OSError_errno_str(int errno_, mp_obj_t str) { + mp_obj_t args[2] = { + MP_OBJ_NEW_SMALL_INT(errno_), + str, + }; + nlr_raise(mp_obj_new_exception_args(&mp_type_OSError, 2, args)); +} + NORETURN void mp_raise_OSError_msg_varg(const compressed_string_t *fmt, ...) { va_list argptr; va_start(argptr,fmt); |
