Issue 6811: add a filename argument to marshal.load* (original) (raw)

Issue6811

Created on 2009-08-31 18:58 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg92113 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-08-31 18:58
For compatibility w/ import, importlib needs the ability to set code.co_filename to the actual location of the bytecode used to create a module and not the path embedded in the marshal data. But since co_filename is read-only it can't be done at the moment. The idea is to add an optional argument to marshal.load* that takes a string representing the file path that co_filename should be set to, overriding what is in the marshal data. A long-term perk of this is that eventually this argument can become required for marshal.loads() and the file path embedded in the marshal data can be removed entirely. marshal.load() would infer its path from file.name. This was all discussed on python-dev; http://mail.python.org/pipermail/python-dev/2009-August/091460.html
msg113116 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-06 17:21
Just flagging this up in case it's dropped under the radar.
msg131940 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-03-23 23:16
New changeset 5deb2094f033 by Brett Cannon in branch 'default': Make importlib compatible with __import__ by "fixing" code.co_filename http://hg.python.org/cpython/rev/5deb2094f033
msg131942 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2011-03-23 23:20
I went with a different solution as backwards-compatibility dictates a solution that is not as complete as one might do with an argument to marshal.
History
Date User Action Args
2022-04-11 14:56:52 admin set github: 51060
2011-03-23 23:20:02 brett.cannon set status: open -> closedresolution: wont fixmessages: + stage: test needed -> resolved
2011-03-23 23:16:07 python-dev set nosy: + python-devmessages: +
2010-08-06 20:44:12 brett.cannon set versions: + Python 3.3, - Python 3.2
2010-08-06 17:21:35 BreamoreBoy set nosy: + BreamoreBoymessages: +
2009-09-07 23:08:18 fwierzbicki set nosy: + fwierzbicki
2009-08-31 19:06:46 fdrake set nosy: + fdrake
2009-08-31 18:58:51 brett.cannon create