From: Guido van Rossum Date: Mon, 10 Jun 2002 19:23:22 +0000 (+0000) Subject: SF bug 563750 (Alex Martelli): posix_tmpfile(): X-Git-Tag: v2.3c1~5394 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=db9198a8b59377e9407811e571be8baca74d2475;p=python SF bug 563750 (Alex Martelli): posix_tmpfile(): The file returned by tmpfile() has mode w+b, so use that in the call to PyFile_FromFile(). Bugfix candidate. --- diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex index aafe7b1977..c02d6a6e5d 100644 --- a/Doc/lib/libos.tex +++ b/Doc/lib/libos.tex @@ -312,7 +312,7 @@ Availability: \UNIX, Windows. \end{funcdesc} \begin{funcdesc}{tmpfile}{} -Return a new file object opened in update mode (\samp{w+}). The file +Return a new file object opened in update mode (\samp{w+b}). The file has no directory entries associated with it and will be automatically deleted once there are no file descriptors for the file. Availability: \UNIX, Windows. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 9d7c3c20a3..95f4613ac3 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -5194,7 +5194,7 @@ posix_tmpfile(PyObject *self, PyObject *args) fp = tmpfile(); if (fp == NULL) return posix_error(); - return PyFile_FromFile(fp, "", "w+", fclose); + return PyFile_FromFile(fp, "", "w+b", fclose); } #endif