summaryrefslogtreecommitdiff
path: root/extmod/moductypes.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-08-16 13:34:12 -0700
committerScott Shawcroft <scott@tannewt.org>2018-08-16 17:41:35 -0700
commit2cd166b57370ab4877ec2d9666225faeac6127ce (patch)
tree645f851b1121ce7f52f4b4cf894844e965c4584d /extmod/moductypes.c
parent137a30ad75803255615a422c15ebcd35fbd31130 (diff)
Fix esp and samd
Diffstat (limited to 'extmod/moductypes.c')
-rw-r--r--extmod/moductypes.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/extmod/moductypes.c b/extmod/moductypes.c
index b0f28331e..e627cd146 100644
--- a/extmod/moductypes.c
+++ b/extmod/moductypes.c
@@ -32,6 +32,8 @@
#include "py/objtuple.h"
#include "py/binary.h"
+#include "supervisor/shared/translate.h"
+
#if MICROPY_PY_UCTYPES
/// \module uctypes - Access data structures in memory
@@ -117,7 +119,7 @@ typedef struct _mp_obj_uctypes_struct_t {
} mp_obj_uctypes_struct_t;
STATIC NORETURN void syntax_error(void) {
- mp_raise_TypeError("syntax error in uctypes descriptor");
+ mp_raise_TypeError(translate("syntax error in uctypes descriptor"));
}
STATIC mp_obj_t uctypes_struct_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
@@ -214,7 +216,7 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
// but scalar structure field is lowered into native Python int, so all
// type info is lost. So, we cannot say if it's scalar type description,
// or such lowered scalar.
- mp_raise_TypeError("Cannot unambiguously get sizeof scalar");
+ mp_raise_TypeError(translate("Cannot unambiguously get sizeof scalar"));
}
syntax_error();
}
@@ -392,7 +394,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
// TODO: Support at least OrderedDict in addition
if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)) {
- mp_raise_TypeError("struct: no fields");
+ mp_raise_TypeError(translate("struct: no fields"));
}
mp_obj_t deref = mp_obj_dict_get(self->desc, MP_OBJ_NEW_QSTR(attr));
@@ -525,7 +527,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_ob
} else {
// load / store
if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
- mp_raise_TypeError("struct: cannot index");
+ mp_raise_TypeError(translate("struct: cannot index"));
}
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->desc);
@@ -539,7 +541,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_ob
uint val_type = GET_TYPE(arr_sz, VAL_TYPE_BITS);
arr_sz &= VALUE_MASK(VAL_TYPE_BITS);
if (index >= arr_sz) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_IndexError, "struct: index out of range"));
+ nlr_raise(mp_obj_new_exception_msg(&mp_type_IndexError, translate("struct: index out of range")));
}
if (t->len == 2) {