Message251851
(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 |
|
Date |
User |
Action |
Args |
2015-09-29 12:45:32 | eric.snow | set | recipients:
+ eric.snow, brett.cannon, ncoghlan |
2015-09-29 12:45:32 | eric.snow | set | messageid: <1443530732.6.0.47195880813.issue25268@psf.upfronthosting.co.za> |
2015-09-29 12:45:32 | eric.snow | link | issue25268 messages |
2015-09-29 12:45:32 | eric.snow | create | |
|