Marc Abramowitz <msabr...@gmail.com> added the comment:

Hmmm if I simply do:

diff -r b66e82c9f852 Lib/importlib/abc.py
--- a/Lib/importlib/abc.py      Tue Jun 26 23:05:27 2012 +0200
+++ b/Lib/importlib/abc.py      Wed Jun 27 12:15:55 2012 -0700
@@ -282,7 +282,7 @@
                 if len(raw_timestamp) < 4:
                     raise EOFError("bad timestamp in {}".format(fullname))
                 pyc_timestamp = _bootstrap._r_long(raw_timestamp)
-                bytecode = data[8:]
+                bytecode = data[12:]
                 # Verify that the magic number is valid.
                 if imp.get_magic() != magic:
                     raise ImportError(

then I get two "ValueError: bad marshal data (unknown type code)" test errors 
in test_abc_loader.

I am unsure as to whether this is a bug in the test or the implementation.

The following quells the errors, but I am not all confident that it's correct:

@@ -302,7 +302,10 @@
                     raise
             else:
                 # Bytecode seems fine, so try to use it.
-                return marshal.loads(bytecode)
+                try:
+                    return marshal.loads(bytecode)
+                except ValueError:
+                    return ''
         elif source_timestamp is None:
             raise ImportError("no source or bytecode available to create code "
                               "object for {0!r}".format(fullname),

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15030>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to