mirror of https://github.com/python/cpython
Fix and enable a skipped test:
with python 2.6, enumerating bytes yields 1-char strings, not numbers. Don't merge this into the py3k branch.
This commit is contained in:
parent
8820f2a979
commit
ce6f6c12c6
|
@ -545,7 +545,7 @@ class StatefulIncrementalDecoder(codecs.IncrementalDecoder):
|
||||||
output = ''
|
output = ''
|
||||||
for b in input:
|
for b in input:
|
||||||
if self.i == 0: # variable-length, terminated with period
|
if self.i == 0: # variable-length, terminated with period
|
||||||
if b == ord('.'):
|
if b == '.':
|
||||||
if self.buffer:
|
if self.buffer:
|
||||||
output += self.process_word()
|
output += self.process_word()
|
||||||
else:
|
else:
|
||||||
|
@ -560,9 +560,9 @@ class StatefulIncrementalDecoder(codecs.IncrementalDecoder):
|
||||||
|
|
||||||
def process_word(self):
|
def process_word(self):
|
||||||
output = ''
|
output = ''
|
||||||
if self.buffer[0] == ord('i'):
|
if self.buffer[0] == 'i':
|
||||||
self.i = min(99, int(self.buffer[1:] or 0)) # set input length
|
self.i = min(99, int(self.buffer[1:] or 0)) # set input length
|
||||||
elif self.buffer[0] == ord('o'):
|
elif self.buffer[0] == 'o':
|
||||||
self.o = min(99, int(self.buffer[1:] or 0)) # set output length
|
self.o = min(99, int(self.buffer[1:] or 0)) # set output length
|
||||||
else:
|
else:
|
||||||
output = self.buffer.decode('ascii')
|
output = self.buffer.decode('ascii')
|
||||||
|
@ -895,8 +895,7 @@ class TextIOWrapperTest(unittest.TestCase):
|
||||||
f.readline()
|
f.readline()
|
||||||
f.tell()
|
f.tell()
|
||||||
|
|
||||||
# FIXME: figure out why the test fails with Python 2.6
|
def testSeekAndTell(self):
|
||||||
def XXXtestSeekAndTell(self):
|
|
||||||
"""Test seek/tell using the StatefulIncrementalDecoder."""
|
"""Test seek/tell using the StatefulIncrementalDecoder."""
|
||||||
|
|
||||||
def lookupTestDecoder(name):
|
def lookupTestDecoder(name):
|
||||||
|
|
Loading…
Reference in New Issue