Bug didn't manifest itself when importing a module with source as .py files are always the first on the search path. The issue only showed up in bytecode-only packages where the calculated file path would be ``__init__.py/__init__.pyc``.
Patch by Alexandru Ardelean.
(cherry picked from commit
c38e32a10061a7c6d54e7e53ffabf7af7998f045)
extensions = (machinery.SOURCE_SUFFIXES[:] +
machinery.BYTECODE_SUFFIXES[:])
for extension in extensions:
- path = os.path.join(path, '__init__'+extension)
- if os.path.exists(path):
+ init_path = os.path.join(path, '__init__' + extension)
+ if os.path.exists(init_path):
+ path = init_path
break
else:
raise ValueError('{!r} is not a package'.format(path))
Heidi Annexstad
Ramchandra Apte
Éric Araujo
+Alexandru Ardelean
Alicia Arlen
Jeffrey Armstrong
Jason Asbahr
variable-argument parameters wrapped with partialmethod.
Patch by Dong-hee Na.
+- bpo-30645: Fix path calculation in imp.load_package(), fixing it for
+ cases when a package is only shipped with bytecodes. Patch by
+ Alexandru Ardelean.
+
- bpo-29931: Fixed comparison check for ipaddress.ip_interface objects.
Patch by Sanjay Sundaresan.