diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2012-10-19 21:58:18 +1000 |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2012-10-19 21:58:18 +1000 |
commit | b48c028ca7b1f8a0215cfe12bbc32961743a554b (patch) | |
tree | 5253b5bae70d447b31d9a9032d0eefdd273b0d68 /Python/import.c | |
parent | 02f69f6965cc3793ffb68399da76a412244da270 (diff) | |
download | cpython-git-b48c028ca7b1f8a0215cfe12bbc32961743a554b.tar.gz |
Issue #6074: Restore the long-broken support for running with read-only source files on Windows
Diffstat (limited to 'Python/import.c')
-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 53c9b293e9..7daba06ad2 100644 --- a/Python/import.c +++ b/Python/import.c @@ -910,6 +910,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; #endif |