You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

14 lines
579 B

--- 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))