Author eltoder
Recipients eltoder
Date 2020-10-23.05:26:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
If a module has a loader, linecache calls its get_source() passing __name__ as the argument. This works most of the time, except that the __main__ module has it set to "__main__", which is commonly not the real name of the module. Luckily, we now have __spec__ which has the real name, so we can just use it.

Attached zip file reproduces the problem:
$ python
Traceback (most recent call last):
  File "", line 11, in <module>
  File "", line 8, in f
  File "", line 8, in f
  File "", line 8, in f
  [Previous line repeated 2 more times]
  File "", line 7, in f

Note that entries from don't have source code lines.
Date User Action Args
2020-10-23 05:26:53eltodersetrecipients: + eltoder
2020-10-23 05:26:53eltodersetmessageid: <>
2020-10-23 05:26:53eltoderlinkissue42125 messages
2020-10-23 05:26:52eltodercreate