This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Arfrever, Marc.Abramowitz, Ronan.Lamy, brett.cannon, eric.snow, jcea, ncoghlan
Date 2012-11-18.08:18:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1353226683.48.0.0512812621998.issue15031@psf.upfronthosting.co.za>
In-reply-to
Content
The suppression flag rings alarm bells for me, as does the fact that all the arguments are optional. Do you remember the rationale for allowing the marshalling errors to propagate rather than falling back to loading from source? It seems weird that a truncated read in the first 12 bytes means to fall back to compiling from source, but truncation after that is a user visible error. Allowing those exceptions to be suppressed as well would simplify things a fair bit.

Regardless, looking at the full patch in context on a real computer (rather than through my phone), suggests to me there needs to be *two* private static methods on _LoaderBasics._parse_bytecode_file:

    _validate_bytecode_header
    _unmarshal_code

SourcelessLoader.get_code would just call these directly, while SourceLoader.parse_cache_contents would suppress exceptions from the first one.

I'll put together a patch illustrating this approach.
History
Date User Action Args
2012-11-18 08:18:03ncoghlansetrecipients: + ncoghlan, brett.cannon, jcea, Arfrever, eric.snow, Marc.Abramowitz, Ronan.Lamy
2012-11-18 08:18:03ncoghlansetmessageid: <1353226683.48.0.0512812621998.issue15031@psf.upfronthosting.co.za>
2012-11-18 08:18:03ncoghlanlinkissue15031 messages
2012-11-18 08:18:03ncoghlancreate