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: inspect.getfile error names module instead of passed class
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.9, Python 3.8
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, flying sheep, miss-islington, terry.reedy
Priority: normal Keywords: patch

Created on 2019-06-06 11:08 by flying sheep, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13861 merged flying sheep, 2019-06-06 11:08
PR 13913 merged miss-islington, 2019-06-08 12:06
PR 13918 merged miss-islington, 2019-06-08 15:02
Messages (7)
msg344799 - (view) Author: (flying sheep) * Date: 2019-06-06 11:08
Currently, inspect.getfile(str) will report nonsense:

>>> inspect.getfile(str)
TypeError: <module 'builtins' (built-in)> is a built-in class
msg345018 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-08 02:47
The correct message would be
"<class 'str'> is a built-in class"

We do not backport exception message changes unless 'buggy enough'.  I asked on core-mentorship whether this fix qualifies.
msg345032 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2019-06-08 12:04
I think landing the fix to 3.8 only is just fine
msg345033 - (view) Author: miss-islington (miss-islington) Date: 2019-06-08 12:05
New changeset d407d2a7265f6102e51a1d62b3fd28b4f7a78d16 by Miss Islington (bot) (Philipp A) in branch 'master':
bpo-37173: Show passed class in inspect.getfile error (GH-13861)
msg345034 - (view) Author: miss-islington (miss-islington) Date: 2019-06-08 12:25
New changeset c5daae4ef6d09269c95ed1023e76932cc179f309 by Miss Islington (bot) in branch '3.8':
bpo-37173: Show passed class in inspect.getfile error (GH-13861)
msg345043 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-08 14:58
Right, 3.8 not being released yet makes it different.
msg345050 - (view) Author: miss-islington (miss-islington) Date: 2019-06-08 15:27
New changeset 51c9cc73cb8768a691688755af0a8b6b12cf712c by Miss Islington (bot) in branch '3.7':
bpo-37173: Show passed class in inspect.getfile error (GH-13861)
Date User Action Args
2022-04-11 14:59:16adminsetgithub: 81354
2019-06-08 15:27:09miss-islingtonsetmessages: + msg345050
2019-06-08 15:02:52miss-islingtonsetpull_requests: + pull_request13791
2019-06-08 14:58:49terry.reedysetmessages: + msg345043
2019-06-08 12:25:04miss-islingtonsetmessages: + msg345034
2019-06-08 12:15:47asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-06-08 12:06:23miss-islingtonsetpull_requests: + pull_request13786
2019-06-08 12:05:51miss-islingtonsetnosy: + miss-islington
messages: + msg345033
2019-06-08 12:04:44asvetlovsetversions: - Python 3.7
2019-06-08 12:04:37asvetlovsetnosy: + asvetlov
messages: + msg345032
2019-06-08 02:47:09terry.reedysetnosy: + terry.reedy
messages: + msg345018
2019-06-06 11:08:35flying sheepsetkeywords: + patch
stage: patch review
pull_requests: + pull_request13736
2019-06-06 11:08:14flying sheepcreate