Commit 311fb781 authored by Marc Abramowitz's avatar Marc Abramowitz

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

--HG--
branch : distribute
extra : rebase_source : ec6f2611d3f8a54b7e11cfadf9d03fdcdef39639
parent d169177b
...@@ -426,6 +426,10 @@ def scan_module(egg_dir, base, name, stubs): ...@@ -426,6 +426,10 @@ def scan_module(egg_dir, base, name, stubs):
pkg = base[len(egg_dir)+1:].replace(os.sep,'.') pkg = base[len(egg_dir)+1:].replace(os.sep,'.')
module = pkg+(pkg and '.' or '')+os.path.splitext(name)[0] module = pkg+(pkg and '.' or '')+os.path.splitext(name)[0]
f = open(filename,'rb'); f.read(8) # skip magic & date f = open(filename,'rb'); f.read(8) # skip magic & date
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() code = marshal.load(f); f.close()
safe = True safe = True
symbols = dict.fromkeys(iter_symbols(code)) symbols = dict.fromkeys(iter_symbols(code))
......
from setuptools import setup
setup(
name='python3.3_bdist_egg_test',
version='0.0.0',
description='Test',
license='BSD',
py_modules=['module'],
author='Marc Abramowitz',
author_email='marc@marc-abramowitz.com',
url='https://bitbucket.org/msabramo/python3.3_bdist_egg_test',
# zip_safe=False,
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment