summaryrefslogtreecommitdiff
path: root/setuptools/command/bdist_egg.py
diff options
context:
space:
mode:
authorMarc Abramowitz <marc@marc-abramowitz.com>2012-06-26 15:15:27 -0700
committerMarc Abramowitz <marc@marc-abramowitz.com>2012-06-26 15:15:27 -0700
commit5867136a372abf824d71592160c200d922ba8b8b (patch)
tree60768365add406876b70b359b0fa9a03e5b5b88a /setuptools/command/bdist_egg.py
parentbdb9bdd4d8e67cbaa7ea6acd5aa26a686a1455f5 (diff)
downloadpython-setuptools-bitbucket-5867136a372abf824d71592160c200d922ba8b8b.tar.gz
Add tests and fix for marshal.load of pyc files on Python 3.3
Fixes https://bitbucket.org/tarek/distribute/issue/283/bdist_egg-issues-with-python-330ax
Diffstat (limited to 'setuptools/command/bdist_egg.py')
-rw-r--r--setuptools/command/bdist_egg.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index 68ca15c7..0ee9c55b 100644
--- a/setuptools/command/bdist_egg.py
+++ b/setuptools/command/bdist_egg.py
@@ -426,7 +426,11 @@ def scan_module(egg_dir, base, name, stubs):
pkg = base[len(egg_dir)+1:].replace(os.sep,'.')
module = pkg+(pkg and '.' or '')+os.path.splitext(name)[0]
f = open(filename,'rb'); f.read(8) # skip magic & date
- code = marshal.load(f); f.close()
+ try:
+ code = marshal.load(f); f.close()
+ except ValueError:
+ f.seek(0); f.read(12) # skip magic & date & file size; file size added in Python 3.3
+ code = marshal.load(f); f.close()
safe = True
symbols = dict.fromkeys(iter_symbols(code))
for bad in ['__file__', '__path__']: