FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-30645: use an internal variable while iterating in imp.load_package() by commodo · Pull Request #2268 · python/cpython · GitHub

Repository navigation

bpo-30645: use an internal variable while iterating in imp.load_package() - #2268

Merged
brettcannon merged 3 commits into
python:masterfrom
commodo:fix-imp-loop
Jun 23, 2017
Merged

brettcannon merged 3 commits into
python:masterfrom
commodo:fix-imp-loop

Conversation

commodo commented Jun 18, 2017

Copy link
Copy Markdown
Contributor

The imp.load_package() function is marked as deprecated,
however, some packages (like virtualenv) seem to use it.

The problem with that loop, is that if the .py file
does not exist, you'll get a
<path-to-package>__init__.py/__init__.pyc file.

When shipping only Python bytecodes, we don't want that.

Signed-off-by: Alexandru Ardelean ardeleanalex@gmail.com

Copy link
Copy Markdown

@commodo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @brettcannon, @ericsnowcurrently and @ncoghlan to be potential reviewers.

brettcannon added needs backport to 2.7 type-bug An unexpected behavior, bug, or error labels Jun 19, 2017
brettcannon self-requested a review June 19, 2017 17:01

Copy link
Copy Markdown
Member

@commodo Did you want to add yourself to the ACKS file and write an entry for Misc/NEWS (somewhere not at the top of the Library section to avoid merge conflicts)?

commodo commented Jun 19, 2017

Copy link
Copy Markdown
Contributor Author

ack
added myself;
force pushed PR

thanks :)

Comment thread Misc/NEWS Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

"use an internal variable" is implementation detail and it's not suitable for NEWS entry.
Please describe the bug you fixed.

commodo commented Jun 20, 2017

Copy link
Copy Markdown
Contributor Author

ack
re-spinned

commodo and others added 3 commits June 21, 2017 14:48
…ge()

The imp.load_package() function is marked as deprecated,
however, some packages (like virtualenv) seem to use it.

The problem with that loop, is that if the .py file
does not exist, you'll get a
`<path-to-package>__init__.py/__init__.pyc` file.

When shipping only Python bytecodes, we don't want that.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>

brettcannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm not worrying about tests since the problem is very obvious and this whole module is actually deprecated.

brettcannon merged commit c38e32a into python:master Jun 23, 2017
brettcannon pushed a commit to brettcannon/cpython that referenced this pull request Jun 23, 2017
…ythonGH-2268)

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 c38e32a)
brettcannon added a commit to brettcannon/cpython that referenced this pull request Jun 23, 2017
…ge() (pythonGH-2268)

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

Copy link
Copy Markdown

GH-2364 is a backport of this pull request to the 3.6 branch.

brettcannon pushed a commit to brettcannon/cpython that referenced this pull request Jun 23, 2017
…ge() (pythonGH-2268)

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

Copy link
Copy Markdown

GH-2365 is a backport of this pull request to the 3.5 branch.

Copy link
Copy Markdown
Member

Thanks for the PR, @commodo !

brettcannon added a commit that referenced this pull request Jun 23, 2017
…ge() (GH-2268) (#2364)

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 c38e32a)
brettcannon added a commit that referenced this pull request Jun 23, 2017
…ge() (GH-2268) (GH-2365)

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

commodo commented Jun 24, 2017

Copy link
Copy Markdown
Contributor Author

thank you :)

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL