Patch # 1331 by Christian Heimes.

The patch fixes some of the problems on Windows. It doesn't introduce
addition problems on Linux.
This commit is contained in:
Guido van Rossum 2007-10-26 04:29:23 +00:00
parent daa251ca09
commit c12a813aa7
7 changed files with 25 additions and 15 deletions

View file

@ -36,7 +36,7 @@ class UnicodeFileTests(unittest.TestCase):
except OSError:
pass
for name in self.files:
f = open(name, 'w')
f = open(name, 'wb')
f.write((name+'\n').encode("utf-8"))
f.close()
os.stat(name)
@ -71,7 +71,7 @@ class UnicodeFileTests(unittest.TestCase):
def test_open(self):
for name in self.files:
f = open(name, 'w')
f = open(name, 'wb')
f.write((name+'\n').encode("utf-8"))
f.close()
os.stat(name)
@ -80,7 +80,7 @@ class UnicodeFileTests(unittest.TestCase):
f1 = os.listdir(test_support.TESTFN)
# Printing f1 is not appropriate, as specific filenames
# returned depend on the local encoding
f2 = os.listdir(str(test_support.TESTFN,
f2 = os.listdir(str(test_support.TESTFN.encode("utf-8"),
sys.getfilesystemencoding()))
f2.sort()
print(f2)
@ -96,7 +96,7 @@ class UnicodeFileTests(unittest.TestCase):
oldwd = os.getcwd()
os.mkdir(dirname)
os.chdir(dirname)
f = open(filename, 'w')
f = open(filename, 'wb')
f.write((filename + '\n').encode("utf-8"))
f.close()
print(repr(filename))