Skip to content

Commit 078172d

Browse files
committed
builtinimport: Improve debugging output.
1 parent e8432b3 commit 078172d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

py/builtinimport.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ bool mp_obj_is_package(mp_obj_t module) {
6161
}
6262

6363
STATIC mp_import_stat_t stat_dir_or_file(vstr_t *path) {
64-
//printf("stat %s\n", vstr_str(path));
6564
mp_import_stat_t stat = mp_import_stat(vstr_null_terminated_str(path));
65+
DEBUG_printf("stat %s: %d\n", vstr_str(path), stat);
6666
if (stat == MP_IMPORT_STAT_DIR) {
6767
return stat;
6868
}
@@ -204,6 +204,7 @@ mp_obj_t mp_builtin___import__(mp_uint_t n_args, const mp_obj_t *args) {
204204
// package's __init__.py does something like "import .submod". So,
205205
// maybe we should check for package here? But quote above doesn't
206206
// talk about packages, it talks about dot-less module names.
207+
DEBUG_printf("Warning: no dots in current module name and level>0\n");
207208
p = this_name + this_name_l;
208209
} else if (level != 0) {
209210
nlr_raise(mp_obj_new_exception_msg(&mp_type_ImportError, "Invalid relative import"));
@@ -264,7 +265,7 @@ mp_obj_t mp_builtin___import__(mp_uint_t n_args, const mp_obj_t *args) {
264265
// create a qstr for the module name up to this depth
265266
qstr mod_name = qstr_from_strn(mod_str, i);
266267
DEBUG_printf("Processing module: %s\n", qstr_str(mod_name));
267-
DEBUG_printf("Previous path: %.*s\n", vstr_len(&path), vstr_str(&path));
268+
DEBUG_printf("Previous path: =%.*s=\n", vstr_len(&path), vstr_str(&path));
268269

269270
// find the file corresponding to the module name
270271
mp_import_stat_t stat;

0 commit comments

Comments
 (0)