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.

classification
Title: PyTraceBack_Print()/_Py_DisplaySourceLine() should take custom loaders into account
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.6, Python 3.3, Python 3.4, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: shiz
Priority: normal Keywords:

Created on 2015-10-24 09:24 by shiz, last changed 2022-04-11 14:58 by admin.

Messages (1)
msg253400 - (view) Author: Shiz (shiz) * Date: 2015-10-24 09:24
Currently, when an error occurs in a module loaded through a loader in sys.meta_path with no direct file name correlation on the filesystem, the traceback source line is empty as such:

  File "/Users/mark/Development/Projects/Rave/rave/rave/game.py", line 65, in run   
    self.window.render(None)                                                        
  File "/.modules/sdl2/video/window.py", line 86, in render                         
  File "/.modules/sdl2/video/window.py", line 259, in swap                          
KeyboardInterrupt   

While the filename has no direct mapping on the file system, what it can do is just do the equivalent of module.__loader__.get_source('module') to retrieve the source code to find the appropriate line in, and only if that fails fall back on trying to interpret the module file name as a normal file system path.
History
Date User Action Args
2022-04-11 14:58:23adminsetgithub: 69654
2015-10-24 09:24:36shizcreate