mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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:
parent
daa251ca09
commit
c12a813aa7
7 changed files with 25 additions and 15 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue