Skip to content

Commit e85b222

Browse files
committed
Don't assume that all non-found modules in create_builtin() are sys/builtin
1 parent 656a64b commit e85b222

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Python/import.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,9 +2435,14 @@ create_builtin(
24352435
p0 = lookup_inittab_initfunc(&info);
24362436
if (p0 == NULL) {
24372437
/* Cannot re-init internal module ("sys" or "builtins") */
2438-
assert(is_core_module(tstate->interp, info.name, info.path));
2439-
mod = import_add_module(tstate, info.name);
2440-
goto finally;
2438+
if (is_core_module(tstate->interp, info.name, info.path)) {
2439+
mod = import_add_module(tstate, info.name);
2440+
goto finally;
2441+
}
2442+
else {
2443+
mod = Py_NewRef(Py_None);
2444+
goto finally;
2445+
}
24412446
}
24422447
}
24432448

0 commit comments

Comments
 (0)