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 brett.cannon
Recipients brett.cannon
Date 2012-11-17.16:00:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1353168017.12.0.0693705888433.issue16494@psf.upfronthosting.co.za>
In-reply-to
Content
With issue #15031 providing a way to take a bytecode file and get a code object out of it, there should probably be a comparable method that takes a code object and a path stats dict and returns the bytes to write out to a file.

This could also be a slight performance win for subclasses of SourceLoader which can read bytecode files but not write them (e.g. zip files where the cost of modifying a zip file is too high). That way the method could raise NotImplementedError (or return None) to signify it doesn't want anything written out by SourceLoader.get_code() and thus skip the entire step of preparing the bytecode file bytes instead of what happens now where set_data() raises NotImplementedError after the whole set of bytes is constructed.

More importantly, it would clean up py_compile once issue #15627 is in with an 'optimize' flag as py_compile.compile() would essentially become ``source = loader.get_source(...); code = loader.compile_source(source, optimize=...); pyc_bytes = loader.create_bytecode_file(code, loader.path_stats(...))``. Otherwise get_code() will need to grow an 'optimize' flag and that doesn't seem necessary.
History
Date User Action Args
2012-11-17 16:00:17brett.cannonsetrecipients: + brett.cannon
2012-11-17 16:00:17brett.cannonsetmessageid: <1353168017.12.0.0693705888433.issue16494@psf.upfronthosting.co.za>
2012-11-17 16:00:17brett.cannonlinkissue16494 messages
2012-11-17 16:00:16brett.cannoncreate