Commit 9553dd99 authored by Stefan H. Holek's avatar Stefan H. Holek

marshall.load() does not necessarily raise ValueError. Fixes #283.

--HG--
branch : distribute
extra : rebase_source : 203cee618118fb65bf109d2db0275aa90aa5a12d
parent 9eca33ff
...@@ -425,12 +425,12 @@ def scan_module(egg_dir, base, name, stubs): ...@@ -425,12 +425,12 @@ def scan_module(egg_dir, base, name, stubs):
return True # Extension module return True # Extension module
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 if sys.version_info < (3, 3):
try: skip = 8 # skip magic & date
code = marshal.load(f); f.close() else:
except ValueError: skip = 12 # skip magic & date & file size
f.seek(0); f.read(12) # skip magic & date & file size; file size added in Python 3.3 f = open(filename,'rb'); f.read(skip)
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))
for bad in ['__file__', '__path__']: for bad in ['__file__', '__path__']:
......
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