Bug report
Bug description:
If we do a lazy import of two submodules in the same package tree (like pkg.a and pkg.b), then accessing pkg.a will cause pkg.b to get imported first. I think this is because pkg gets bound specifically to a lazy_import object for pkg.b. (In fact, just accessing pkg also imports pkg.b).
main.py:
lazy import pkg.a
lazy import pkg.b
print(globals()['pkg']) # <lazy_import 'pkg.b'>
pkg.a # triggers import of pkg (of course), pkg.b (sketchy!!), pkg.a (of course)
pkg/
├── __init__.py # print("pkg")
├── a.py # print("pkg.a")
└── b.py # print("pkg.b")
This prints:
<lazy_import 'pkg.b'>
pkg
pkg.b
pkg.a
CPython versions tested on:
3.15
Operating systems tested on:
Linux
Bug report
Bug description:
If we do a lazy import of two submodules in the same package tree (like
pkg.aandpkg.b), then accessingpkg.awill causepkg.bto get imported first. I think this is because pkg gets bound specifically to a lazy_import object forpkg.b. (In fact, just accessingpkgalso importspkg.b).main.py:This prints:
CPython versions tested on:
3.15
Operating systems tested on:
Linux