summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-10-19 12:38:14 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2012-10-19 12:38:14 (GMT)
commit34937ce249864871bee129fbaa30a4dc0d317834 (patch)
tree07fd7a080cd86171f61c4ede807419d51048545b /Python
parent2d51f687e133fb8141f1a6b5a6ac51c9d5eddf58 (diff)
downloadcpython-34937ce249864871bee129fbaa30a4dc0d317834.zip
cpython-34937ce249864871bee129fbaa30a4dc0d317834.tar.gz
cpython-34937ce249864871bee129fbaa30a4dc0d317834.tar.bz2
Issue #6074: Forward port Windows read-only source file fix from 2.7
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index beb0eec..4695c96 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 |