Title: py_compile.compile fails if existing bytecode file is unwritable
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
Status: pending 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-01-25 14:12 by iritkatriel.

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:
Date User Action Args
2022-01-25 14:12:02iritkatrielsetstatus: open -> pending

nosy: + iritkatriel
messages: + msg411592

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