[Python-Dev] __pycache__ creation
Barry Warsaw
barry at python.org
Tue Mar 23 23:32:12 CET 2010
On Mar 22, 2010, at 12:38 PM, Guido van Rossum wrote:
>Huh? Last time I looked weren't we going to make __pycache__ the
>default (and eventually only) behavior?
We definitely agreed it would be the default in Python 3.2.
My recollection is that we agreed it would be the only on-demand way of
writing pyc files, but that Python would read a lone .pyc file where the
source would be if the source is missing, and that py_compile/compileall would
support optional creation of those lone .pyc files.
>I see only two reasonable solutions for __pycache__ creation -- either
>we change all setup/install scripts (both for core Python and for 3rd
>party packages) to always create a __pycache__ subdirectory for every
>directory (including package directories) installed; or we somehow
>create it the first time it's needed.
>
>But creating it as needed runs into at least similar problems with
>ownership as creating .pyc files when first needed (if the parent
>directory is root-owned a mere mortal can't create it at all). So even
>apart from the security issue (which I haven't thought about deeply) I
>think precreation should at least be an easily accessible option both
>for the core (where it can be done by compileall) and for 3rd party
>packages (where I guess it's up to distutils or whatever install
>mechanism is used).
So you're +1 on Tough Luck? I think that's the best answer. You will be able
to arrange pre-creation though compileall with the right layout and presumably
the right umask if you want.
-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/20100323/77db9189/attachment.pgp>
More information about the Python-Dev
mailing list