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.

classification
Title: py_compile.compile fails if existing bytecode file is unwritable
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: byrnes, iritkatriel
Priority: normal Keywords:

Created on 2015-12-28 22:39 by byrnes, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg257142 - (view) Author: Robert Byrnes (byrnes) Date: 2015-12-28 22:39
In Python/import.c, open_exclusive unlinks any existing bytecode file before opening to create a new one.

However, py_compile.compile doesn't unlink before opening, and therefore fails if an existing bytecode file is unwritable.  It would be nice to unlink first in this case too.
msg411592 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-25 14:12
It is explicitly documented that existing files are not overwritten and the script fails in this case, so I think this is a feature:

https://docs.python.org/3/library/py_compile.html#py_compile.compile
History
Date User Action Args
2022-04-11 14:58:25adminsetgithub: 70158
2022-02-06 19:15:28iritkatrielsetstatus: pending -> closed
stage: resolved
2022-01-25 14:12:02iritkatrielsetstatus: open -> pending

nosy: + iritkatriel
messages: + msg411592

resolution: rejected
2015-12-28 22:39:25byrnescreate