classification
Title: inspect documentation describes module type inaccurately
Type: Stage: patch review
Components: Documentation Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eric.snow, furkanonder, miss-islington, ncoghlan
Priority: normal Keywords: easy

Created on 2014-06-14 19:58 by eric.snow, last changed 2021-06-21 15:17 by iritkatriel.

Pull Requests
URL Status Linked Edit
PR 19097 merged furkanonder, 2020-03-21 01:17
Messages (5)
msg220576 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2014-06-14 19:58
In the documentation for the inspect module, the module type is described with just 2 of its potential 7 attributes.  The language reference[2] and importlib docs[3] both provide an accurate list of module attributes.

Furthermore, the description for __file__ should be fixed.  It should be clear that __file__ reflects the location from which the module was loaded, that location is not necessarily a filename, and the attribute may not exist if the module was not loaded from a specific location (e.g. builtin and frozen modules).  The same goes for __cached__

[1] https://docs.python.org/dev/library/inspect.html#types-and-members
[2] https://docs.python.org/3/reference/import.html#import-related-module-attributes
[3] https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec
msg364831 - (view) Author: Furkan Onder (furkanonder) * Date: 2020-03-22 23:29
I sent a PR to fix a __file__ description.
https://github.com/python/cpython/pull/19097
msg366210 - (view) Author: Furkan Onder (furkanonder) * Date: 2020-04-11 13:31
PR has been sent.
msg395472 - (view) Author: miss-islington (miss-islington) Date: 2021-06-09 21:10
New changeset 878d7e4ee464913438fd59582bbb795e7e0fa387 by Furkan Onder in branch 'main':
 bpo-21760: fix __file__ description (GH-19097)
https://github.com/python/cpython/commit/878d7e4ee464913438fd59582bbb795e7e0fa387
msg395475 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2021-06-09 21:15
I've merged the changes for __file__.  Thanks, furkanonder!

The fixes in the types module remain to be done, though now I see 4 of the relevant attributes instead of 2.  (missing: __path__, __file__, __cached__)
History
Date User Action Args
2021-06-21 15:17:15iritkatrielsetkeywords: + easy, - patch
versions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.4, Python 3.5
2021-06-09 21:15:49eric.snowsetmessages: + msg395475
2021-06-09 21:10:36miss-islingtonsetnosy: + miss-islington
messages: + msg395472
2020-04-11 13:31:40furkanondersetmessages: + msg366210
2020-03-22 23:29:08furkanondersetmessages: + msg364831
2020-03-21 01:17:40furkanondersetkeywords: + patch
nosy: + furkanonder

pull_requests: + pull_request18457
stage: needs patch -> patch review
2020-03-18 18:05:30brett.cannonsetnosy: - brett.cannon
2014-06-14 20:16:28eric.snowsetnosy: + brett.cannon, ncoghlan
2014-06-14 19:58:13eric.snowcreate