Author Marc.Abramowitz
Recipients Arfrever, Marc.Abramowitz, Ronan.Lamy, brett.cannon, georg.brandl, jcea, loewis, pitrou
Date 2012-06-27.19:23:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340825032.77.0.472370272076.issue15030@psf.upfronthosting.co.za>
In-reply-to
Content
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),
History
Date User Action Args
2012-06-27 19:23:53Marc.Abramowitzsetrecipients: + Marc.Abramowitz, loewis, brett.cannon, georg.brandl, jcea, pitrou, Arfrever, Ronan.Lamy
2012-06-27 19:23:52Marc.Abramowitzsetmessageid: <1340825032.77.0.472370272076.issue15030@psf.upfronthosting.co.za>
2012-06-27 19:23:52Marc.Abramowitzlinkissue15030 messages
2012-06-27 19:23:50Marc.Abramowitzcreate