summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorHye-Shik Chang <hyeshik@gmail.com>2007-06-05 18:58:51 (GMT)
committerHye-Shik Chang <hyeshik@gmail.com>2007-06-05 18:58:51 (GMT)
commit9b5414090b8cdd7fb086578003398066585a42c7 (patch)
treeb0d831e90bd53dfed625b02efa3df27380f9b716 /Lib
parent82958f0d3b503d7fc448377993e6884f7c51157e (diff)
downloadcpython-9b5414090b8cdd7fb086578003398066585a42c7.zip
cpython-9b5414090b8cdd7fb086578003398066585a42c7.tar.gz
cpython-9b5414090b8cdd7fb086578003398066585a42c7.tar.bz2
Bug #1728403: Fix a bug that CJKCodecs StreamReader hangs when it
reads a file that ends with incomplete sequence and sizehint argument for .read() is specified.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_multibytecodec.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
index de27339..b6557f3 100644
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -136,11 +136,19 @@ class Test_IncrementalDecoder(unittest.TestCase):
self.assertRaises(UnicodeDecodeError, decoder.decode, '', True)
self.assertEqual(decoder.decode('B@$'), u'\u4e16')
+class Test_StreamReader(unittest.TestCase):
+ def test_bug1728403(self):
+ try:
+ open(TESTFN, 'w').write('\xa1')
+ f = codecs.open(TESTFN, encoding='cp949')
+ self.assertRaises(UnicodeDecodeError, f.read, 2)
+ finally:
+ os.unlink(TESTFN)
class Test_StreamWriter(unittest.TestCase):
if len(u'\U00012345') == 2: # UCS2
def test_gb18030(self):
- s= StringIO.StringIO()
+ s = StringIO.StringIO()
c = codecs.getwriter('gb18030')(s)
c.write(u'123')
self.assertEqual(s.getvalue(), '123')