[New-bugs-announce] [issue25468] PyTraceBack_Print()/_Py_DisplaySourceLine() should take custom loaders into account

Shiz report at bugs.python.org
Sat Oct 24 05:24:36 EDT 2015


New submission from Shiz:

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.

----------
components: Interpreter Core
messages: 253400
nosy: shiz
priority: normal
severity: normal
status: open
title: PyTraceBack_Print()/_Py_DisplaySourceLine() should take custom loaders into account
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25468>
_______________________________________


More information about the New-bugs-announce mailing list