[Python-Dev] Unexpected behaviour in compileall

Vinay Sajip vinay_sajip at yahoo.co.uk
Wed Nov 2 12:37:52 CET 2011


I just started getting errors in my PEP 404 / pythonv branch, but they don't
at first glance appear related to the functionality of this branch. What I'm
seeing is that during installation, some of the .pyc/.pyo files written by
compileall have mode 600 rather than the expected 644, with the result that
test_compileall fails when run from the installed Python as an unprivileged
user. If I manually do

sudo chmod a+r /usr/local/lib/python3.3/__pycache__/*

then test_compileall works again.

I added a diagnostic to compileall.py, here's an extract from the log of the
subsequent installation:

Listing '/usr/local/lib/python3.3'...
Compiling '/usr/local/lib/python3.3/__future__.py'...
Mode of [...]/__pycache__/__future__.cpython-33.pyc is 644
Compiling '/usr/local/lib/python3.3/__phello__.foo.py'...
Mode of [...]/__pycache__/__phello__.foo.cpython-33.pyc is 644
Compiling '/usr/local/lib/python3.3/_compat_pickle.py'...
Mode of [...]/__pycache__/_compat_pickle.cpython-33.pyc is 644
Compiling '/usr/local/lib/python3.3/_dummy_thread.py'...
Mode of [...]/__pycache__/_dummy_thread.cpython-33.pyc is 644
Compiling '/usr/local/lib/python3.3/_markupbase.py'...
Mode of [...]/__pycache__/_markupbase.cpython-33.pyc is 644
Compiling '/usr/local/lib/python3.3/_pyio.py'...
Mode of [...]/__pycache__/_pyio.cpython-33.pyc is 644
Compiling '/usr/local/lib/python3.3/_strptime.py'...
Mode of [...]/__pycache__/_strptime.cpython-33.pyc is 644
Compiling '/usr/local/lib/python3.3/_sysconfigdata.py'...
Mode of [...]/__pycache__/_sysconfigdata.cpython-33.pyc is 600
Compiling '/usr/local/lib/python3.3/_threading_local.py'...
Mode of [...]/__pycache__/_threading_local.cpython-33.pyc is 644
Compiling '/usr/local/lib/python3.3/_weakrefset.py'...
Mode of [...]/__pycache__/_weakrefset.cpython-33.pyc is 600
Compiling '/usr/local/lib/python3.3/abc.py'...
Mode of [...]/__pycache__/abc.cpython-33.pyc is 600
Compiling '/usr/local/lib/python3.3/aifc.py'...
Mode of [...]/__pycache__/aifc.cpython-33.pyc is 644

The 600s and 644s are interspersed with no pattern immediately apparent. All
the source files have mode 644, as expected.

This happens on two different Posix machines - Ubuntu Natty and OS X Leopard
 - so doesn't seem to be related to the external environment.

Can anyone shed any light as to what might be going on? 

Regards,

Vinay Sajip



More information about the Python-Dev mailing list