[issue25268] Support pointing frozen modules to the corresponding source files, if available.
Eric Snow
report at bugs.python.org
Tue Sep 29 14:45:32 CEST 2015
New submission from Eric Snow:
(a generalization of issue #21335)
One way or another, we should be able to record the appropriate path in the resulting data when a module is frozen. Keeping track of the source location is useful when debugging, especially with tracebacks. Also see a related conversation on python-dev. [1]
If the original filename for a frozen module is preserved, several possibilities open up:
* the `get_source` method of `importlib._bootstrap.FrozenImporter` could return the original source
* the traceback module could work around the co_filename issue pointed out in #21335
* the filename could be incorporated into the value set for co_filename and __file__
* frozen modules could be optionally reloaded from source
Given that the filename would (likely) be available only through loading the module, it *might* not make sense to store it on the module's spec. However, it might also make sense to store the filename in a way that it can be exposed during the "find" stage of import. In that case it would arguably *belong* on the module's spec.
Note that there's a chance that the original filename for a frozen module is no longer available. That shouldn't be much of a problem, though.
[1] https://mail.python.org/pipermail/python-dev/2014-April/134097.html
----------
components: Library (Lib)
messages: 251851
nosy: brett.cannon, eric.snow, ncoghlan
priority: low
severity: normal
stage: needs patch
status: open
title: Support pointing frozen modules to the corresponding source files, if available.
type: enhancement
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25268>
_______________________________________
More information about the Python-bugs-list
mailing list