summaryrefslogtreecommitdiff
path: root/py/objcomplex.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-08-08 18:24:49 -0700
committerScott Shawcroft <scott@tannewt.org>2018-08-09 13:29:30 -0700
commit96ebf5bc3fb455162286b9bc31e763f3c4f1c457 (patch)
tree3d06bc866bcf943a0e0ea881a1fcab9826291a1c /py/objcomplex.c
parent9da79c880e387ab05a683b67feb8f3da600d937d (diff)
Two fixes and translate more strings.
* Fix finding translations with escaped characters. * Add back \r to translations since its needed by screen.
Diffstat (limited to 'py/objcomplex.c')
-rw-r--r--py/objcomplex.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/py/objcomplex.c b/py/objcomplex.c
index 261c2b1f0..3336d7b05 100644
--- a/py/objcomplex.c
+++ b/py/objcomplex.c
@@ -31,6 +31,8 @@
#include "py/parsenum.h"
#include "py/runtime.h"
+#include "supervisor/shared/translate.h"
+
#if MICROPY_PY_BUILTINS_COMPLEX
#include <math.h>
@@ -198,13 +200,13 @@ mp_obj_t mp_obj_complex_binary_op(mp_binary_op_t op, mp_float_t lhs_real, mp_flo
}
case MP_BINARY_OP_FLOOR_DIVIDE:
case MP_BINARY_OP_INPLACE_FLOOR_DIVIDE:
- mp_raise_TypeError("can't do truncated division of a complex number");
+ mp_raise_TypeError(translate("can't do truncated division of a complex number"));
case MP_BINARY_OP_TRUE_DIVIDE:
case MP_BINARY_OP_INPLACE_TRUE_DIVIDE:
if (rhs_imag == 0) {
if (rhs_real == 0) {
- mp_raise_msg(&mp_type_ZeroDivisionError, "complex division by zero");
+ mp_raise_msg(&mp_type_ZeroDivisionError, translate("complex division by zero"));
}
lhs_real /= rhs_real;
lhs_imag /= rhs_real;
@@ -232,7 +234,7 @@ mp_obj_t mp_obj_complex_binary_op(mp_binary_op_t op, mp_float_t lhs_real, mp_flo
if (rhs_imag == 0 && rhs_real >= 0) {
lhs_real = (rhs_real == 0);
} else {
- mp_raise_msg(&mp_type_ZeroDivisionError, "0.0 to a complex power");
+ mp_raise_msg(&mp_type_ZeroDivisionError, translate("0.0 to a complex power"));
}
} else {
mp_float_t ln1 = MICROPY_FLOAT_C_FUN(log)(abs1);