]> granicus.if.org Git - python/commitdiff
SF bug 563750 (Alex Martelli): posix_tmpfile():
authorGuido van Rossum <guido@python.org>
Mon, 10 Jun 2002 19:23:22 +0000 (19:23 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 10 Jun 2002 19:23:22 +0000 (19:23 +0000)
The file returned by tmpfile() has mode w+b, so use that in the call
to PyFile_FromFile().

Bugfix candidate.

Doc/lib/libos.tex
Modules/posixmodule.c

index aafe7b19775b14663a0b6c892b1734609ddc8dab..c02d6a6e5dd6a11a35f61ad95a9c31cf0dcb1292 100644 (file)
@@ -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.
index 9d7c3c20a3ebf49617666b44cd2c51385e5c69e4..95f4613ac346d5ee34808eff49d5ba2a758d98a7 100644 (file)
@@ -5194,7 +5194,7 @@ posix_tmpfile(PyObject *self, PyObject *args)
     fp = tmpfile();
     if (fp == NULL)
         return posix_error();
-    return PyFile_FromFile(fp, "<tmpfile>", "w+", fclose);
+    return PyFile_FromFile(fp, "<tmpfile>", "w+b", fclose);
 }
 #endif