summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-08 20:18:39 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-08 20:18:39 (GMT)
commit2b08b38deacc065b4fea8421528de1eed66d56b0 (patch)
treec85bfda4933486d96b8466115f16df9df98fbff0
parent57b93ad56d570c27bd3de3820b996352121c18e2 (diff)
downloadcpython-2b08b38deacc065b4fea8421528de1eed66d56b0.zip
cpython-2b08b38deacc065b4fea8421528de1eed66d56b0.tar.gz
cpython-2b08b38deacc065b4fea8421528de1eed66d56b0.tar.bz2
Fix a few places where a str instead of a bytes object was used.
-rw-r--r--Lib/io.py2
-rw-r--r--Lib/test/test_io.py8
2 files changed, 5 insertions, 5 deletions
diff --git a/Lib/io.py b/Lib/io.py
index 2b85da7..4ac4e45 100644
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -1047,7 +1047,7 @@ class TextIOWrapper(TextIOBase):
return self._encode_decoder_state(decoder_state, position)
saved_state = decoder.getstate()
try:
- decoder.setstate(("", decoder_state))
+ decoder.setstate((b"", decoder_state))
n = 0
bb = bytes(1)
for i, bb[0] in enumerate(readahead):
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 957ce29..d1c0f68 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -87,9 +87,9 @@ class IOTest(unittest.TestCase):
self.assertEqual(f.tell(), 6)
self.assertEqual(f.seek(-1, 1), 5)
self.assertEqual(f.tell(), 5)
- self.assertEqual(f.write(" world\n\n\n"), 9)
+ self.assertEqual(f.write(str8(" world\n\n\n")), 9)
self.assertEqual(f.seek(0), 0)
- self.assertEqual(f.write("h"), 1)
+ self.assertEqual(f.write(b"h"), 1)
self.assertEqual(f.seek(-1, 2), 13)
self.assertEqual(f.tell(), 13)
self.assertEqual(f.truncate(12), 12)
@@ -230,7 +230,7 @@ class IOTest(unittest.TestCase):
def test_close_flushes(self):
f = io.open(test_support.TESTFN, "wb")
- f.write("xxx")
+ f.write(b"xxx")
f.close()
f = io.open(test_support.TESTFN, "rb")
self.assertEqual(f.read(), b"xxx")
@@ -595,7 +595,7 @@ class TextIOWrapperTest(unittest.TestCase):
f.close()
f = io.open(test_support.TESTFN, "r", encoding="utf-8")
s = f.read(prefix_size)
- self.assertEquals(s, prefix)
+ self.assertEquals(s, str(prefix))
self.assertEquals(f.tell(), prefix_size)
self.assertEquals(f.readline(), u_suffix)