Skip to content

[3.6] bpo-30645: don't append to an inner loop path in imp.load_package() (GH-2268) #2364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Lib/imp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Ankur Ankan
Heidi Annexstad
Ramchandra Apte
Éric Araujo
Alexandru Ardelean
Alicia Arlen
Jeffrey Armstrong
Jason Asbahr
Expand Down
4 changes: 4 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ Library
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.

Expand Down