diff options
| author | Dan Halbert <halbert@halwitz.org> | 2018-08-09 20:00:18 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-09 20:00:18 -0400 |
| commit | bbc034cd3dfc46ee7938faedc915fec91610c6a3 (patch) | |
| tree | 4fe11d359088e41790030fce0763471b76ab3fb4 /py/objexcept.c | |
| parent | b735b9dbed2132f07793324a40770f4bd96d9ae8 (diff) | |
| parent | 24e53ad5911f42efb6508b4a8dcf4a196a81494a (diff) | |
Merge pull request #1104 from tannewt/more_strings
Fixes and translate more strings.
Diffstat (limited to 'py/objexcept.c')
| -rw-r--r-- | py/objexcept.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/py/objexcept.c b/py/objexcept.c index 5b5650c5f..68897d44d 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -37,6 +37,8 @@ #include "py/gc.h" #include "py/mperrno.h" +#include "supervisor/shared/translate.h" + // Number of items per traceback entry (file, line, block) #define TRACEBACK_ENTRY_LEN (3) @@ -112,9 +114,9 @@ void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kin } else if (o->args->len == 1) { // try to provide a nice OSError error message if (o->base.type == &mp_type_OSError && MP_OBJ_IS_SMALL_INT(o->args->items[0])) { - qstr qst = mp_errno_to_str(o->args->items[0]); - if (qst != MP_QSTR_NULL) { - mp_printf(print, "[Errno " INT_FMT "] %q", MP_OBJ_SMALL_INT_VALUE(o->args->items[0]), qst); + const char* msg = mp_errno_to_str(o->args->items[0]); + if (msg[0] != '\0') { + mp_printf(print, "[Errno " INT_FMT "] %s", MP_OBJ_SMALL_INT_VALUE(o->args->items[0]), msg); return; } } |
