summaryrefslogtreecommitdiff
path: root/py/obj.c
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-08-01 12:14:55 -0500
committerJeff Epler <jepler@gmail.com>2020-08-04 13:34:29 -0500
commitdddd25a776fb0d9c002c1b6b039e24bb3048e6ff (patch)
tree72406398044fe8064b7e43fcd3c8e16f7a86b6f5 /py/obj.c
parentc394af412837f96164ebcc88d5301bece19e4a6f (diff)
Combine similar strings to reduce size of translations
This is a slight trade-off with code size, in places where a "_varg" mp_raise variant is now used. The net savings on trinket_m0 is just 32 bytes. It also means that the translation will include the original English text, and cannot be translated. These are usually names of Python types such as int, set, or dict or special values such as "inf" or "Nan".
Diffstat (limited to 'py/obj.c')
-rw-r--r--py/obj.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/py/obj.c b/py/obj.c
index 7644b5de8..2b0c46f49 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -263,7 +263,7 @@ mp_int_t mp_obj_get_int(mp_const_obj_t arg) {
mp_raise_TypeError(translate("can't convert to int"));
} else {
mp_raise_TypeError_varg(
- translate("can't convert %s to int"), mp_obj_get_type_str(arg));
+ translate("can't convert %s to %s"), mp_obj_get_type_str(arg), "int");
}
}
}
@@ -326,7 +326,7 @@ mp_float_t mp_obj_get_float(mp_obj_t arg) {
mp_raise_TypeError(translate("can't convert to float"));
} else {
mp_raise_TypeError_varg(
- translate("can't convert %s to float"), mp_obj_get_type_str(arg));
+ translate("can't convert %s to %s"), mp_obj_get_type_str(arg), "float");
}
}
@@ -359,7 +359,7 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) {
mp_raise_TypeError(translate("can't convert to complex"));
} else {
mp_raise_TypeError_varg(
- translate("can't convert %s to complex"), mp_obj_get_type_str(arg));
+ translate("can't convert %s to %s"), mp_obj_get_type_str(arg), "complex");
}
}
}