summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index bccb971..2b82587 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -930,7 +930,11 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
{
FILE *fp;
time_t mtime = srcstat->st_mtime;
- mode_t mode = srcstat->st_mode;
+#ifdef MS_WINDOWS /* since Windows uses different permissions */
+ mode_t mode = srcstat->st_mode & ~S_IEXEC;
+#else
+ mode_t mode = srcstat->st_mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH;
+#endif
fp = open_exclusive(cpathname, mode);
if (fp == NULL) {