Kaydet (Commit) 6203d8fa authored tarafından Guido van Rossum's avatar Guido van Rossum

Patch 1341 by Amaury Forgeot d'Arc.

This patch corrects test_fileinput on Windows: when redirecting stdout,
os.open should be given O_BINARY, because the file descriptor is then
wrapped in a text-mode file; os.fdopen(fd, "w").
üst 3db4686b
...@@ -326,9 +326,11 @@ class FileInput: ...@@ -326,9 +326,11 @@ class FileInput:
except OSError: except OSError:
self._output = open(self._filename, "w") self._output = open(self._filename, "w")
else: else:
fd = os.open(self._filename, mode = os.O_CREAT | os.O_WRONLY | os.O_TRUNC
os.O_CREAT | os.O_WRONLY | os.O_TRUNC, if hasattr(os, 'O_BINARY'):
perm) mode |= os.O_BINARY
fd = os.open(self._filename, mode, perm)
self._output = os.fdopen(fd, "w") self._output = os.fdopen(fd, "w")
try: try:
if hasattr(os, 'chmod'): if hasattr(os, 'chmod'):
......
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