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.
Created on 2012年11月17日 16:00 by brett.cannon, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg175762 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2012年11月17日 16:00 | |
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. |
|||
| msg222782 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2014年07月11日 19:24 | |
@Brett as #15627 is in would you like to follow up on this. |
|||
| msg223425 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2014年07月18日 18:50 | |
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. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:38 | admin | set | github: 60698 |
| 2014年07月18日 18:50:42 | brett.cannon | set | status: open -> closed resolution: rejected messages: + msg223425 |
| 2014年07月12日 13:40:03 | brett.cannon | set | assignee: brett.cannon versions: + Python 3.5, - Python 3.4 |
| 2014年07月11日 19:24:05 | BreamoreBoy | set | nosy:
+ BreamoreBoy messages: + msg222782 |
| 2012年12月03日 15:37:10 | asvetlov | set | nosy:
+ asvetlov |
| 2012年11月26日 17:12:05 | jcea | set | nosy:
+ jcea |
| 2012年11月17日 16:05:52 | brett.cannon | set | 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 |
| 2012年11月17日 16:05:36 | brett.cannon | set | title: Method on importlib.SourceLoader for creating bytecode file format/container -> Add a ethod on importlib.SourceLoader for creating bytecode file format/container |
| 2012年11月17日 16:00:17 | brett.cannon | create | |