diff Python/import.c @ 79828:1856d57abfc8 3.2

Issue #6074: Forward port Windows read-only source file fix from 2.7
author Nick Coghlan <ncoghlan@gmail.com>
date Fri, 19 Oct 2012 22:38:14 +1000
parents 56dc7b09f390
children e829d644d366 3f6db10b7a69
line wrap: on
line diff
--- a/Python/import.c	Fri Oct 19 13:40:28 2012 +0200
+++ b/Python/import.c	Fri Oct 19 22:38:14 2012 +1000
@@ -1174,6 +1174,12 @@
     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 |