unix/main: Add NLR scope for checking module __path__.
If the module has a user-defined getattr, this could raise. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
committed by
Damien George
parent
99a0c45aef
commit
952a78f88a
@@ -664,8 +664,9 @@ MP_NOINLINE int main_(int argc, char **argv) {
|
|||||||
return handle_uncaught_exception(nlr.ret_val) & 0xff;
|
return handle_uncaught_exception(nlr.ret_val) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this module is a package, see if it has a `__main__.py`.
|
||||||
mp_obj_t dest[2];
|
mp_obj_t dest[2];
|
||||||
mp_load_method_maybe(mod, MP_QSTR___path__, dest);
|
mp_load_method_protected(mod, MP_QSTR___path__, dest, true);
|
||||||
if (dest[0] != MP_OBJ_NULL && !subpkg_tried) {
|
if (dest[0] != MP_OBJ_NULL && !subpkg_tried) {
|
||||||
subpkg_tried = true;
|
subpkg_tried = true;
|
||||||
vstr_t vstr;
|
vstr_t vstr;
|
||||||
|
|||||||
Reference in New Issue
Block a user