File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -208,15 +208,8 @@ STATIC mp_obj_t resource_stream(mp_obj_t package_in, mp_obj_t path_in) {
208208 // package parameter being None, the path_in is interpreted as a
209209 // raw path.
210210 if (package_in != mp_const_none ) {
211- mp_obj_t args [5 ];
212- args [0 ] = package_in ;
213- args [1 ] = mp_const_none ; // TODO should be globals
214- args [2 ] = mp_const_none ; // TODO should be locals
215- args [3 ] = mp_const_true ; // Pass sentinel "non empty" value to force returning of leaf module
216- args [4 ] = MP_OBJ_NEW_SMALL_INT (0 );
217-
218- // TODO lookup __import__ and call that instead of going straight to builtin implementation
219- mp_obj_t pkg = mp_builtin___import__ (5 , args );
211+ // Pass "True" as sentinel value in fromlist to force returning of leaf module
212+ mp_obj_t pkg = mp_import_name (mp_obj_str_get_qstr (package_in ), mp_const_true , MP_OBJ_NEW_SMALL_INT (0 ));
220213
221214 mp_obj_t dest [2 ];
222215 mp_load_method_maybe (pkg , MP_QSTR___path__ , dest );
You can’t perform that action at this time.
0 commit comments