Nick Coghlan <ncogh...@gmail.com> added the comment:

This problem isn't unique to Cython extension modules - it exists for pyc-only 
distribution of pure Python files as well.

The underlying problem is that we don't currently have a mechanism comparable 
to JavaScript source maps, whereby a preprocessed runtime artifact can provide 
a reference back to a more debugging-friendly representation that's stored 
somewhere else (whether that's adjacent to the compiled form, in a different 
directory elsewhere on the same machine, or even on a remote web server).

So I think asking how ExtensionFileLoader.get_source() should behave is likely 
looking at the problem at the wrong level: a better question may be to ask what 
feature *linecache* is missing to allow it to correctly report source lines for 
modules that do *not* include their source code when installed, but do have 
that source code available in a shadow directory, where the only things that 
change are the root location (which could potentially even be a HTTP or HTTPS 
URL), and a fixed transformation on the module filename itself (e.g. replacing 
"*.so" with "*.c", or "*.pyc" with "*.py").

Given such a feature in Python 3.8, and support for it in Cython, the enhanced 
linecache module could then be published to PyPI as backports.linecache, 
providing access to this improved behaviour on all Python 3 versions that 
SageMath wants to support.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32797>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to