Skip to content

bpo-26131: deprecate the use of load_module()#22905

Closed
brettcannon wants to merge 4 commits into
python:masterfrom
brettcannon:deprecate-load_module
Closed

bpo-26131: deprecate the use of load_module()#22905
brettcannon wants to merge 4 commits into
python:masterfrom
brettcannon:deprecate-load_module

Conversation

@brettcannon

@brettcannon brettcannon commented Oct 23, 2020

Copy link
Copy Markdown
Member

Deprecating the use of load_module() requires two parts:

  1. The actual load_module() implementations are deprecated.
  2. Use of load_module() as a fallback for exec_module() trigger an ImportWarning.

This makes sure that either direct use of the method or indirect use by the import system raises some warning.

The method itself has been documented as deprecated since Python 3.6 and has been superceded by exec_module().

https://bugs.python.org/issue26131

@warsaw warsaw 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.

One suggestion. There are also test failures.

Comment thread Lib/importlib/_bootstrap.py Outdated
@bedevere-bot

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@brettcannon

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@warsaw: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from warsaw October 23, 2020 18:14
@brettcannon

Copy link
Copy Markdown
Member Author

This is going to require implementing exec_module() for zipimport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants