[Python-Dev] __file__ and bytecode-only

Barry Warsaw barry at python.org
Mon Mar 22 16:21:08 CET 2010


On Mar 16, 2010, at 07:44 PM, Nick Coghlan wrote:

>In Python 3.1, *invoking* py_compile.compile() will create 2.x style
>bytecode. Similarly, when force==False, compileall.compile_dir() and
>compileall.compile_path() will check for 2.x style bytecode in order to
>decide whether or not to compile the module.
>
>The question for 3.2 is what bytecode layout py_compile.compile() should
>generate. For the precompile-a-system-library use case it should clearly
>generate a PEP 3147 layout and this probably makes sense as the default
>behaviour in 3.2.
>
>However, for production of bytecode-only packages, it would be
>convenient to be able to explicitly invoke the 2.x style behaviour
>without having to specify the target filename explicitly using the
>'cfile' parameter (which isn't exposed at the compileall layer anyway).

My working branch modifies py_compile to produce PEP 3147 layout by default.
I agree that it should support traditional pyc output as an option, and
compileall should support this as well.

-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100322/c94658c9/attachment.pgp>


More information about the Python-Dev mailing list