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

  1. --- a/Lib/imp.py
  2. +++ b/Lib/imp.py
  3. @@ -203,8 +203,9 @@ def load_package(name, path):
  4. extensions = (machinery.SOURCE_SUFFIXES[:] +
  5. machinery.BYTECODE_SUFFIXES[:])
  6. for extension in extensions:
  7. - path = os.path.join(path, '__init__'+extension)
  8. - if os.path.exists(path):
  9. + init_path = os.path.join(path, '__init__'+extension)
  10. + if os.path.exists(init_path):
  11. + path = init_path
  12. break
  13. else:
  14. raise ValueError('{!r} is not a package'.format(path))