[New-bugs-announce] [issue6811] add a filename argument to marshal.load*

Brett Cannon report at bugs.python.org
Mon Aug 31 20:58:53 CEST 2009

New submission from Brett Cannon <brett at python.org>:

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 

This was all discussed on python-dev; 

assignee: brett.cannon
components: Extension Modules
messages: 92113
nosy: brett.cannon
priority: low
severity: normal
stage: test needed
status: open
title: add a filename argument to marshal.load*
type: feature request
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list