mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
Revert the fix for #1548891, it broke backwards compatibility with arbitrary read buffers.
Fixes #1730114.
This commit is contained in:
parent
52c0c368b9
commit
9616444427
4 changed files with 9 additions and 28 deletions
|
@ -121,28 +121,6 @@ class TestStringIO(TestGenericStringIO):
|
|||
class TestcStringIO(TestGenericStringIO):
|
||||
MODULE = cStringIO
|
||||
|
||||
def test_unicode(self):
|
||||
|
||||
if not test_support.have_unicode: return
|
||||
|
||||
# The cStringIO module converts Unicode strings to character
|
||||
# strings when writing them to cStringIO objects.
|
||||
# Check that this works.
|
||||
|
||||
f = self.MODULE.StringIO()
|
||||
f.write(unicode(self._line[:5]))
|
||||
s = f.getvalue()
|
||||
self.assertEqual(s, 'abcde')
|
||||
self.assertEqual(type(s), types.StringType)
|
||||
|
||||
f = self.MODULE.StringIO(unicode(self._line[:5]))
|
||||
s = f.getvalue()
|
||||
self.assertEqual(s, 'abcde')
|
||||
self.assertEqual(type(s), types.StringType)
|
||||
|
||||
self.assertRaises(UnicodeEncodeError, self.MODULE.StringIO,
|
||||
unicode('\xf4', 'latin-1'))
|
||||
|
||||
import sys
|
||||
if sys.platform.startswith('java'):
|
||||
# Jython doesn't have a buffer object, so we just do a useless
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue