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.

Title: Wrong references to deprecated find_module instead of find_spec
Type: Stage: commit review
Components: Documentation Versions: Python 3.6, Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, docs@python, eric.snow, martin.panter, ncoghlan, python-dev, raulcd, takluyver
Priority: normal Keywords: patch

Created on 2015-04-13 17:22 by raulcd, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
issue23936.patch raulcd, 2015-04-14 21:50 review
finders_and_specs.patch takluyver, 2015-12-03 17:16 review
finders_and_specs2.patch takluyver, 2015-12-04 12:48 review
finders_and_specs3.patch takluyver, 2015-12-04 18:18 review
Messages (14)
msg240671 - (view) Author: Raúl Cumplido (raulcd) * Date: 2015-04-13 17:22
While taking a look on the import mechanisms I've seen in the documentation that find_module has been deprecated for find_spec, but on different parts of the documentation there are still references to find_module, as in the definition of sys.meta_path (

Shouldn't it be (example on this case) a list of finder objects that have their find_spec() methods called, instead of find_module method?

I've been taking a look on and I can see we call find_spec:

for finder in sys.meta_path:
    with _ImportLockContext():
            find_spec = finder.find_spec

If you agree with me that this is wrong I'll submit a patch to fix it.
msg240902 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-04-14 15:08
You're right, it should be find_spec.
msg241037 - (view) Author: Raúl Cumplido (raulcd) * Date: 2015-04-14 21:50
Added changes on both places where there was still references to find_module without specifying that has been deprecated.
msg255821 - (view) Author: Thomas Kluyver (takluyver) * Date: 2015-12-03 17:16
I also ran into confusion with this while trying to write an import hook.

Attached is my shot at a docs patch. I've done a slightly larger rewording, trying to make it easier to understand, and added more links between parts of the docs.

I left mentions of the deprecated find_module and find_loader methods in the 'finder' glossary entry, but for sys.meta_path I have only described find_spec() - it does still fall back to the deprecated methods, but I thought that trying to explain that would make the description of meta_path harder to follow.
msg255847 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-12-03 23:59
Thanks for adding that link to ModuleSpec, it is definitely needed to make sense of a lot of stuff.

I left some review comments and questions.

If the behaviour of sys.meta_path has changed, I think it needs a “New/changed in version X” notice. If it makes the modern description hard to follow, maybe keep it in a separate paragraph.
msg255863 - (view) Author: Thomas Kluyver (takluyver) * Date: 2015-12-04 12:48
Updated patch attached, responding to Martin's suggestions.

I'm not quite sure what to do about the 'finder' glossary entry. 'Finder' now seems to be a more abstract classification covering two distinct kinds of thing: *meta path finders* and *path entry finders*. They have similar methods (find_spec, find_module), but with slightly different signatures. Is 'finder' a sufficiently meaningful concept to remain in the glossary, or should we take it out and be explicit about what type of finder is meant elsewhere in the docs?
msg255870 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-12-04 17:47
The generic "finder" glossary entry should be rather generic and then point to "meta path finder" and "path entry finder" for dis-ambiguity (and both of those terms are already in the glossary).
msg255871 - (view) Author: Thomas Kluyver (takluyver) * Date: 2015-12-04 17:57
That's basically what I was aiming for. Should the description be briefer and more generic?
msg255873 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-12-04 18:09
I vote for more generic; left a review to that effect.
msg255874 - (view) Author: Thomas Kluyver (takluyver) * Date: 2015-12-04 18:18
Third revision of patch responding to Brett's suggestions.
msg255876 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-12-04 19:37
LGTM; I will commit it when I have a chance.
msg255879 - (view) Author: Thomas Kluyver (takluyver) * Date: 2015-12-04 20:32
Thanks Brett :-)
msg255898 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-12-04 23:46
New changeset 88cee7d16ccb by Brett Cannon in branch '3.5':
Issue #23936: Clarify what finders are.

New changeset 1b1900d2a537 by Brett Cannon in branch 'default':
Merge for issue #23936
msg255899 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-12-04 23:48
Thanks for the bug report, Raúl, and the patch, Thomas!
Date User Action Args
2022-04-11 14:58:15adminsetgithub: 68124
2015-12-04 23:48:41brett.cannonsetstatus: open -> closed
resolution: fixed
messages: + msg255899

versions: + Python 3.6, - Python 3.4
2015-12-04 23:46:50python-devsetnosy: + python-dev
messages: + msg255898
2015-12-04 20:32:32takluyversetmessages: + msg255879
2015-12-04 19:37:05brett.cannonsetmessages: + msg255876
stage: patch review -> commit review
2015-12-04 18:18:14takluyversetfiles: + finders_and_specs3.patch

messages: + msg255874
2015-12-04 18:09:52brett.cannonsetmessages: + msg255873
2015-12-04 17:57:09takluyversetmessages: + msg255871
2015-12-04 17:47:31brett.cannonsetmessages: + msg255870
2015-12-04 12:48:26takluyversetfiles: + finders_and_specs2.patch

messages: + msg255863
2015-12-03 23:59:53martin.pantersetnosy: + martin.panter

messages: + msg255847
stage: patch review
2015-12-03 17:17:45brett.cannonsetassignee: docs@python -> brett.cannon
2015-12-03 17:16:05takluyversetfiles: + finders_and_specs.patch
nosy: + takluyver
messages: + msg255821

2015-04-14 21:50:07raulcdsetfiles: + issue23936.patch
keywords: + patch
messages: + msg241037
2015-04-14 15:08:37brett.cannonsetnosy: + ncoghlan
messages: + msg240902
2015-04-13 17:22:55raulcdcreate