[issue42125] linecache cannot get source for the __main__ module with a custom loader

2021-05-29 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42125] linecache cannot get source for the __main__ module with a custom loader

2020-12-18 Thread Eugene Toder


Change by Eugene Toder :


--
nosy: +ncoghlan, vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42125] linecache cannot get source for the __main__ module with a custom loader

2020-12-16 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42125] linecache cannot get source for the __main__ module with a custom loader

2020-12-15 Thread Eugene Toder


Change by Eugene Toder :


--
nosy: +brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42125] linecache cannot get source for the __main__ module with a custom loader

2020-10-22 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 1.0 -> 2.0
pull_requests: +21839
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22908

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42125] linecache cannot get source for the __main__ module with a custom loader

2020-10-22 Thread Eugene Toder


New submission from Eugene Toder :

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 t.zip
Traceback (most recent call last):
  ...
  File "t.zip/t.py", line 11, in 
  File "t.zip/t.py", line 8, in f
  File "t.zip/t.py", line 8, in f
  File "t.zip/t.py", line 8, in f
  [Previous line repeated 2 more times]
  File "t.zip/t.py", line 7, in f
ValueError

Note that entries from t.py don't have source code lines.

--
components: Library (Lib)
files: t.zip
messages: 379408
nosy: eltoder
priority: normal
severity: normal
status: open
title: linecache cannot get source for the __main__ module with a custom loader
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file49536/t.zip

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com