You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/brettcannon'closed_at=<Date2014-07-18.18:50:42.350>created_at=<Date2012-11-17.16:00:17.112>labels= ['type-feature', 'library']
title='Add a method on importlib.SourceLoader for creating bytecode file format/container'updated_at=<Date2014-07-18.18:50:42.349>user='https://github.com/brettcannon'
With issue bpo-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 bpo-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.
brettcannon
changed the title
Method on importlib.SourceLoader for creating bytecode file format/container
Add a ethod on importlib.SourceLoader for creating bytecode file format/container
Nov 17, 2012
brettcannon
changed the title
Add a ethod on importlib.SourceLoader for creating bytecode file format/container
Add a method on importlib.SourceLoader for creating bytecode file format/container
Nov 17, 2012
I think I want to keep bytecode files as optimizations as much as possible, so exposing anything that explicitly writes them is just going to lead to headaches.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: