mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #6074: Restore the long-broken support for running with read-only source files on Windows
This commit is contained in:
parent
02f69f6965
commit
b48c028ca7
3 changed files with 56 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue