diff options
| author | Nick Coghlan <ncoghlan@gmail.com> | 2012-10-19 22:38:14 +1000 |
|---|---|---|
| committer | Nick Coghlan <ncoghlan@gmail.com> | 2012-10-19 22:38:14 +1000 |
| commit | 77f5571ab7cbe88b7f8cd3f61539a7865170bc4c (patch) | |
| tree | e08a63f060ded596ff5483b0957a399a5e2a90f7 /Python | |
| parent | 32d3c7acf9cc1423a08fb7e47e1b3329ea7793ee (diff) | |
| download | cpython-77f5571ab7cbe88b7f8cd3f61539a7865170bc4c.tar.gz | |
Issue #6074: Forward port Windows read-only source file fix from 2.7
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/import.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c index beb0eecb5a..4695c96970 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1174,6 +1174,12 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat) time_t mtime = srcstat->st_mtime; #ifdef MS_WINDOWS /* since Windows uses different permissions */ mode_t mode = srcstat->st_mode & ~S_IEXEC; + /* Issue #6074: We ensure user write access, so we can delete it later + * when the source file changes. (On POSIX, this only requires write + * access to the directory, on Windows, we need write access to the file + * as well) + */ + mode |= _S_IWRITE; #else mode_t mode = srcstat->st_mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH; mode_t dirmode = (srcstat->st_mode | |
