525557738c
This makes it so that sub-packages are resolved relative to their parent's
`__path__`, rather than re-resolving each parent's filesystem path.
The previous behavior was that `import foo.bar` would first re-search
`sys.path` for `foo`, then use the resulting path to find `bar`.
For already-loaded and u-prefixed modules, because we no longer need to
build the path from level to level, we no longer unnecessarily search
the filesystem. This should improve startup time.
Explicitly makes the resolving process clear:
- Loaded modules are returned immediately without touching the filesystem.
- Exact-match of builtins are also returned immediately.
- Then the filesystem search happens.
- If that fails, then the weak-link handling is applied.
This maintains the existing behavior: if a user writes `import time` they
will get time.py if it exits, otherwise the built-in utime. Whereas `import
utime` will always return the built-in.
This also fixes a regression from
|
||
---|---|---|
.. | ||
argcheck.c | ||
asmarm.c | ||
asmarm.h | ||
asmbase.c | ||
asmbase.h | ||
asmthumb.c | ||
asmthumb.h | ||
asmx64.c | ||
asmx64.h | ||
asmx86.c | ||
asmx86.h | ||
asmxtensa.c | ||
asmxtensa.h | ||
bc.c | ||
bc.h | ||
bc0.h | ||
binary.c | ||
binary.h | ||
builtin.h | ||
builtinevex.c | ||
builtinhelp.c | ||
builtinimport.c | ||
compile.c | ||
compile.h | ||
dynruntime.h | ||
dynruntime.mk | ||
emit.h | ||
emitbc.c | ||
emitcommon.c | ||
emitglue.c | ||
emitglue.h | ||
emitinlinethumb.c | ||
emitinlinextensa.c | ||
emitnarm.c | ||
emitnative.c | ||
emitnthumb.c | ||
emitnx64.c | ||
emitnx86.c | ||
emitnxtensa.c | ||
emitnxtensawin.c | ||
formatfloat.c | ||
formatfloat.h | ||
frozenmod.c | ||
frozenmod.h | ||
gc.c | ||
gc.h | ||
grammar.h | ||
lexer.c | ||
lexer.h | ||
make_root_pointers.py | ||
makecompresseddata.py | ||
makemoduledefs.py | ||
makeqstrdata.py | ||
makeqstrdefs.py | ||
makeversionhdr.py | ||
malloc.c | ||
map.c | ||
misc.h | ||
mkenv.mk | ||
mkrules.cmake | ||
mkrules.mk | ||
modarray.c | ||
modbuiltins.c | ||
modcmath.c | ||
modcollections.c | ||
modgc.c | ||
modio.c | ||
modmath.c | ||
modmicropython.c | ||
modstruct.c | ||
modsys.c | ||
modthread.c | ||
moduerrno.c | ||
mpconfig.h | ||
mperrno.h | ||
mphal.h | ||
mpprint.c | ||
mpprint.h | ||
mpstate.c | ||
mpstate.h | ||
mpthread.h | ||
mpz.c | ||
mpz.h | ||
nativeglue.c | ||
nativeglue.h | ||
nlr.c | ||
nlr.h | ||
nlraarch64.c | ||
nlrmips.c | ||
nlrpowerpc.c | ||
nlrsetjmp.c | ||
nlrthumb.c | ||
nlrx64.c | ||
nlrx86.c | ||
nlrxtensa.c | ||
obj.c | ||
obj.h | ||
objarray.c | ||
objarray.h | ||
objattrtuple.c | ||
objbool.c | ||
objboundmeth.c | ||
objcell.c | ||
objclosure.c | ||
objcomplex.c | ||
objdeque.c | ||
objdict.c | ||
objenumerate.c | ||
objexcept.c | ||
objexcept.h | ||
objfilter.c | ||
objfloat.c | ||
objfun.c | ||
objfun.h | ||
objgenerator.c | ||
objgenerator.h | ||
objgetitemiter.c | ||
objint.c | ||
objint.h | ||
objint_longlong.c | ||
objint_mpz.c | ||
objlist.c | ||
objlist.h | ||
objmap.c | ||
objmodule.c | ||
objmodule.h | ||
objnamedtuple.c | ||
objnamedtuple.h | ||
objnone.c | ||
objobject.c | ||
objpolyiter.c | ||
objproperty.c | ||
objrange.c | ||
objreversed.c | ||
objset.c | ||
objsingleton.c | ||
objslice.c | ||
objstr.c | ||
objstr.h | ||
objstringio.c | ||
objstringio.h | ||
objstrunicode.c | ||
objtuple.c | ||
objtuple.h | ||
objtype.c | ||
objtype.h | ||
objzip.c | ||
opmethods.c | ||
pairheap.c | ||
pairheap.h | ||
parse.c | ||
parse.h | ||
parsenum.c | ||
parsenum.h | ||
parsenumbase.c | ||
parsenumbase.h | ||
persistentcode.c | ||
persistentcode.h | ||
profile.c | ||
profile.h | ||
py.cmake | ||
py.mk | ||
pystack.c | ||
pystack.h | ||
qstr.c | ||
qstr.h | ||
qstrdefs.h | ||
reader.c | ||
reader.h | ||
repl.c | ||
repl.h | ||
ringbuf.c | ||
ringbuf.h | ||
runtime.c | ||
runtime.h | ||
runtime0.h | ||
runtime_utils.c | ||
scheduler.c | ||
scope.c | ||
scope.h | ||
sequence.c | ||
showbc.c | ||
smallint.c | ||
smallint.h | ||
stackctrl.c | ||
stackctrl.h | ||
stream.c | ||
stream.h | ||
unicode.c | ||
unicode.h | ||
usermod.cmake | ||
vm.c | ||
vmentrytable.h | ||
vstr.c | ||
warning.c |