Skip to content

bpo-42131: Add PEP 451-related methods to zipimport #23187

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 6 commits into from
Nov 13, 2020

Conversation

brettcannon
Copy link
Member

@brettcannon brettcannon commented Nov 7, 2020

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

Can find_loader and load_module be expressed in terms of find_spec?

Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

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

LGTM, although I'm also curious as to whether or not the old methods could be redefined in terms of the new one.

Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
@brettcannon
Copy link
Member Author

@serhiy-storchaka @ncoghlan the reason I didn't port the old methods over is I'm planning to deprecate them (and all other instances of find_module, find_loader, and load_module in the stdlib). I'm doing this first as I need it to land another PR which makes calling load_module raise an ImportWarning if __spec__.loader doesn't exist (#22905 was my attempt at that, but test_ensurepip of all things kept failing due to runpy importing the zip file). When I submit that PR I will deprecate these old methods in zipimport, and so porting seems unnecessary. It also makes porting to the new methods easier since you won't to contend with your code potentially breaking and having to move to a new API.

@brettcannon brettcannon merged commit d2e94bb into python:master Nov 13, 2020
@brettcannon brettcannon deleted the zipimport-spec branch November 13, 2020 23:14
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Specifically, find_spec(), create_module(), and exec_module().

Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants