Merge pull request #3355 from jepler/import-builtin-submodule-crash-unix

builtinimport: Fix a crash with 'import ulab.linalg' on unix port only
This commit is contained in:
Scott Shawcroft 2020-08-31 14:44:18 -07:00 committed by GitHub
commit 877a4f47cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -488,7 +488,7 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
// afterwards. // afterwards.
gc_collect(); gc_collect();
} }
if (outer_module_obj != MP_OBJ_NULL) { if (outer_module_obj != MP_OBJ_NULL && VERIFY_PTR(outer_module_obj) ) {
qstr s = qstr_from_strn(mod_str + last, i - last); qstr s = qstr_from_strn(mod_str + last, i - last);
mp_store_attr(outer_module_obj, s, module_obj); mp_store_attr(outer_module_obj, s, module_obj);
// The above store can cause a dictionary rehash and new allocation. So, // The above store can cause a dictionary rehash and new allocation. So,