diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2018-07-31 16:53:54 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2018-08-07 14:58:57 -0700 |
| commit | 933add6cd833bb6ba6682ad2b6eb478871415ff5 (patch) | |
| tree | 8cb5ee1feb0516c24ee270fcee5ed00d310aced8 /shared-bindings/struct/__init__.c | |
| parent | 2029c4e87e3e71ada07c8be91fe6877edf4a606b (diff) | |
Support internationalisation.
Diffstat (limited to 'shared-bindings/struct/__init__.c')
| -rw-r--r-- | shared-bindings/struct/__init__.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index 5be255971..093597785 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -36,6 +36,7 @@ #include "py/parsenum.h" #include "shared-bindings/struct/__init__.h" #include "shared-module/struct/__init__.h" +#include "supervisor/shared/translate.h" //| :mod:`struct` --- manipulation of c-style data //| ======================================================== @@ -85,7 +86,6 @@ STATIC mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_obj, 1, MP_OBJ_FUN_ARGS_MAX, struct_pack); - //| .. function:: pack_into(fmt, buffer, offset, v1, v2, ...) //| //| Pack the values v1, v2, ... according to the format string fmt into a buffer @@ -100,7 +100,7 @@ STATIC mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) { // negative offsets are relative to the end of the buffer offset = (mp_int_t)bufinfo.len + offset; if (offset < 0) { - mp_raise_RuntimeError("buffer too small"); + mp_raise_RuntimeError(translate("buffer too small")); } } byte *p = (byte *)bufinfo.buf; @@ -142,7 +142,7 @@ STATIC mp_obj_t struct_unpack_from(size_t n_args, const mp_obj_t *args) { // negative offsets are relative to the end of the buffer offset = bufinfo.len + offset; if (offset < 0) { - mp_raise_RuntimeError("buffer too small"); + mp_raise_RuntimeError(translate("buffer too small")); } } p += offset; |
