This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: add a filename argument to marshal.load*
Type: enhancement Stage: resolved
Components: Extension Modules Versions: Python 3.3
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: BreamoreBoy, brett.cannon, fdrake, fwierzbicki, python-dev
Priority: low Keywords:

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:52adminsetgithub: 51060
2011-03-23 23:20:02brett.cannonsetstatus: open -> closed
resolution: wont fix
messages: + msg131942

stage: test needed -> resolved
2011-03-23 23:16:07python-devsetnosy: + python-dev
messages: + msg131940
2010-08-06 20:44:12brett.cannonsetversions: + Python 3.3, - Python 3.2
2010-08-06 17:21:35BreamoreBoysetnosy: + BreamoreBoy
messages: + msg113116
2009-09-07 23:08:18fwierzbickisetnosy: + fwierzbicki
2009-08-31 19:06:46fdrakesetnosy: + fdrake
2009-08-31 18:58:51brett.cannoncreate