This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kevin.chen
Recipients Steve.Thompson, amaury.forgeotdarc, barry, brian.curtin, desolat, eric.araujo, kevin.chen, markon, mucisland, pdsimanyi, pitrou
Date 2012-08-19.12:50:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1345380638.34.0.173578427079.issue6074@psf.upfronthosting.co.za>
In-reply-to
Content
I propose a fix: static FILE * open_exclusive(char *filename, mode_t mode) { #if defined(O_EXCL)&&defined(O_CREAT)&&defined(O_WRONLY)&&defined(O_TRUNC) /* Use O_EXCL to avoid a race condition when another process tries to write the same file. When that happens, our open() call fails, which is just fine (since it's only a cache). XXX If the file exists and is writable but the directory is not writable, the file will never be written. Oh well. */ int fd; (void) unlink(filename); fd = open(filename, O_EXCL|O_CREAT|O_WRONLY|O_TRUNC #ifdef O_BINARY |O_BINARY /* necessary for Windows */ #endif #ifdef __VMS , mode, "ctxt=bin", "shr=nil" #elif defined(MS_WINDOWS)	, mode | _S_IWRITE #else , mode #endif ); if (fd < 0 ) return NULL; return fdopen(fd, "wb"); #else /* Best we can do -- on Windows this can't happen anyway */ return fopen(filename, "wb"); #endif } ---------------------- so doesn't matter what the .py file permission is under windows, the .pyc file will always have both read and write permissions.
History
Date User Action Args
2012-08-19 12:50:38kevin.chensetrecipients: + kevin.chen, barry, amaury.forgeotdarc, pitrou, eric.araujo, brian.curtin, pdsimanyi, markon, mucisland, Steve.Thompson, desolat
2012-08-19 12:50:38kevin.chensetmessageid: <1345380638.34.0.173578427079.issue6074@psf.upfronthosting.co.za>
2012-08-19 12:50:17kevin.chenlinkissue6074 messages
2012-08-19 12:50:16kevin.chencreate