This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Raise ImportWarning when falling back to find_module()
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, hroncok, vstinner
Priority: normal Keywords: patch

Created on 2020-10-23 23:10 by brett.cannon, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25044 merged brett.cannon, 2021-03-27 19:14
Messages (5)
msg379492 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-10-23 23:10
find_spec() has superseded find_module() since Python 3.4.
msg389833 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2021-03-30 15:43
New changeset a7ff6df60c05e1b69fca743573b1e118bebf121d by Brett Cannon in branch 'master':
bpo-42134: Raise ImportWarning when calling find_module() in the import system (GH-25044)
https://github.com/python/cpython/commit/a7ff6df60c05e1b69fca743573b1e118bebf121d
msg390511 - (view) Author: Miro Hrončok (hroncok) * Date: 2021-04-08 08:35
Brett, would you accept a PR that changes the changelog entry to contain the ".find_spec() not found; falling back to find_module()" message, for better search-ability? I needed to use grep + git blame to be able to find out what's going on.

Also, could you please explain how to migrate to find_spec() in https://docs.python.org/3.10/whatsnew/3.10.html#porting-to-python-3-10 ? I'd do that, but I don't know yet what is the proper way.
msg390513 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-04-08 08:55
See also bpo-43540 "importlib: Document how to replace load_module() in What's New in Python 3.10".
msg390554 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2021-04-08 21:31
> would you accept a PR that changes the changelog entry to contain the ".find_spec() not found; falling back to find_module()" message, for better search-ability?

Sure!

> Also, could you please explain how to migrate to find_spec() in https://docs.python.org/3.10/whatsnew/3.10.html#porting-to-python-3-10 ? I'd do that, but I don't know yet what is the proper way.

The problem is it will possibly vary from class to class. You can probably get pretty far with https://docs.python.org/3/library/importlib.html#importlib.util.spec_from_file_location or https://docs.python.org/3/library/importlib.html#importlib.util.spec_from_loader depending.
History
Date User Action Args
2022-04-11 14:59:37adminsetgithub: 86300
2021-04-08 21:31:25brett.cannonsetmessages: + msg390554
2021-04-08 08:55:07vstinnersetmessages: + msg390513
2021-04-08 08:35:17hroncoksetnosy: + vstinner, hroncok
messages: + msg390511
2021-03-30 19:08:43brett.cannonsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-03-30 15:43:21brett.cannonsetmessages: + msg389833
2021-03-29 22:53:17brett.cannonsetassignee: brett.cannon
2021-03-27 19:14:14brett.cannonsetkeywords: + patch
stage: patch review
pull_requests: + pull_request23792
2020-10-23 23:11:40brett.cannonlinkissue42135 dependencies
2020-10-23 23:10:10brett.cannoncreate