summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/imp.py5
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS4
3 files changed, 8 insertions, 2 deletions
diff --git a/Lib/imp.py b/Lib/imp.py
index 781ff23..866464b 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -203,8 +203,9 @@ def load_package(name, path):
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))
diff --git a/Misc/ACKS b/Misc/ACKS
index 4f98e98..eaff172 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -57,6 +57,7 @@ Ankur Ankan
Heidi Annexstad
Ramchandra Apte
Éric Araujo
+Alexandru Ardelean
Alicia Arlen
Jeffrey Armstrong
Jason Asbahr
diff --git a/Misc/NEWS b/Misc/NEWS
index 55e5bce..fc9e1de 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -428,6 +428,10 @@ Library
- bpo-30508: Don't log exceptions if Task/Future "cancel()" method was
called.
+- 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-11822: The dis.dis() function now is able to disassemble nested
code objects.