Issue #20778: Fix modulefinder to work with bytecode-only modules.

Bug filed and initial attempt at a patch by Bohuslav Kabrda.
This commit is contained in:
Brett Cannon 2014-02-28 10:44:45 -05:00
parent 815b41b1cd
commit 298bb96776
3 changed files with 23 additions and 1 deletions

View file

@ -287,7 +287,7 @@ class ModuleFinder:
if fp.read(4) != imp.get_magic():
self.msgout(2, "raise ImportError: Bad magic number", pathname)
raise ImportError("Bad magic number in %s" % pathname)
fp.read(4)
fp.read(8) # Skip mtime and size.
co = marshal.load(fp)
else:
co = None