Commit db9198a8 authored by Guido van Rossum's avatar Guido van Rossum

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.
parent 7f147a77
......@@ -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.
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment