Skip to content

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

Merged
brettcannon merged 6 commits into
python:masterfrom
brettcannon:zipimport-spec
Nov 13, 2020
Merged

bpo-42131: Add PEP 451-related methods to zipimport#23187
brettcannon merged 6 commits into
python:masterfrom
brettcannon:zipimport-spec

Conversation

@brettcannon

@brettcannonbrettcannon commented Nov 7, 2020

Copy link
Copy Markdown
Member

@serhiy-storchakaserhiy-storchaka 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.

Can find_loader and load_module be expressed in terms of find_spec?

@ncoghlanncoghlan left a comment

Copy link
Copy Markdown
Contributor

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.

Comment threadDoc/library/zipimport.rst
Comment threadDoc/library/zipimport.rst Outdated
Comment threadLib/test/test_zipimport.py Outdated
Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
@brettcannon

Copy link
Copy Markdown
MemberAuthor

@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:masterNov 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 freeto 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

@brettcannon@ncoghlan@serhiy-storchaka@the-knights-who-say-ni@bedevere-bot