aboutsummaryrefslogtreecommitdiff
path: root/py/builtinimport.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2020-03-02 22:35:22 +1100
committerDamien George <damien.p.george@gmail.com>2020-04-05 15:02:06 +1000
commitdef76fe4d9bbc2c342594dc05861b24d7165d274 (patch)
treed04ad778e2421de0a85835227ba5bcb08562ec24 /py/builtinimport.c
parent85858e72dfdc3e941c2e620e94de05ad663138b1 (diff)
all: Use MP_ERROR_TEXT for all error messages.
Diffstat (limited to 'py/builtinimport.c')
-rw-r--r--py/builtinimport.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/py/builtinimport.c b/py/builtinimport.c
index 50106a88e..5c82c68d9 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -228,7 +228,7 @@ STATIC void do_load(mp_obj_t module_obj, vstr_t *file) {
}
#else
// If we get here then the file was not frozen and we can't compile scripts.
- mp_raise_msg(&mp_type_ImportError, "script compilation not supported");
+ mp_raise_msg(&mp_type_ImportError, MP_ERROR_TEXT("script compilation not supported"));
#endif
}
@@ -313,7 +313,7 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
// We must have some component left over to import from
if (p == this_name) {
- mp_raise_ValueError("cannot perform relative import");
+ mp_raise_ValueError(MP_ERROR_TEXT("cannot perform relative import"));
}
uint new_mod_l = (mod_len == 0 ? (size_t)(p - this_name) : (size_t)(p - this_name) + 1 + mod_len);
@@ -397,9 +397,9 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
if (module_obj == MP_OBJ_NULL) {
// couldn't find the file, so fail
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
- mp_raise_msg(&mp_type_ImportError, "module not found");
+ mp_raise_msg(&mp_type_ImportError, MP_ERROR_TEXT("module not found"));
#else
- mp_raise_msg_varg(&mp_type_ImportError, "no module named '%q'", mod_name);
+ mp_raise_msg_varg(&mp_type_ImportError, MP_ERROR_TEXT("no module named '%q'"), mod_name);
#endif
}
} else {
@@ -478,7 +478,7 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
// Check that it's not a relative import
if (n_args >= 5 && MP_OBJ_SMALL_INT_VALUE(args[4]) != 0) {
- mp_raise_NotImplementedError("relative import");
+ mp_raise_NotImplementedError(MP_ERROR_TEXT("relative import"));
}
// Check if module already exists, and return it if it does
@@ -500,9 +500,9 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
// Couldn't find the module, so fail
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
- mp_raise_msg(&mp_type_ImportError, "module not found");
+ mp_raise_msg(&mp_type_ImportError, MP_ERROR_TEXT("module not found"));
#else
- mp_raise_msg_varg(&mp_type_ImportError, "no module named '%q'", module_name_qstr);
+ mp_raise_msg_varg(&mp_type_ImportError, MP_ERROR_TEXT("no module named '%q'"), module_name_qstr);
#endif
}