Issue 7016: .pyc files are set executable if the .py file is too (original) (raw)

Issue7016

Created on 2009-09-29 06:57 by steven.daprano, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg93254 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2009-09-29 06:57
In Python 2.6, .pyc files inherit the executable bit from their .py file. This can lead to strangeness: $ echo pass > test.py $ chmod u+x test.py $ python2.6 -c "import test" $ ls -l test.pyc -rwxrw-r-- 1 steve steve 94 2009-09-29 16:54 test.pyc $ ./test.pyc : command not found ��
msg93281 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2009-09-29 11:51
Steven> $ echo pass > test.py Steven> $ chmod u+x test.py Steven> $ python2.6 -c "import test" Steven> $ ls -l test.pyc Steven> -rwxrw-r-- 1 steve steve 94 2009-09-29 16:54 test.pyc Steven> $ ./test.pyc Steven> : command not found And if you try ./test.py I presume you also get an error in this trivial case. If your .py file is not meant to be executed, why set the execute bit? I do agree it's a little strange to also set the execute bit on the .pyc file though. Skip
msg93283 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-09-29 12:15
This is a duplicate of issue 6070, and has been fixed.
History
Date User Action Args
2022-04-11 14:56:53 admin set github: 51265
2009-09-29 12:15:12 r.david.murray set status: open -> closedpriority: normalsuperseder: Python 2.6 makes .pyc/.pyo bytecode files executablenosy: + r.david.murraymessages: + resolution: out of datestage: resolved
2009-09-29 11:51:40 skip.montanaro set nosy: + skip.montanaromessages: +
2009-09-29 06:57:07 steven.daprano create