[Python-Dev] Should bytearray(b'a')[0] should 1-char or number? (original) (raw)

ocean ocean at m2.ccsnet.ne.jp
Fri May 2 11:47:41 CEST 2008


I tried to post this to bug tracker, but couldn't, so posted here...

r62095 says

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 is true for bytes, but not for bytearray.

bytearray(b'a')[0] 97 [28493 refs] b'a'[0] 'a'

And this causes error on my environment like this.

====================================================================== FAIL: testDecoder (main.StatefulIncrementalDecoderTest)

Traceback (most recent call last): File "test_io.py", line 629, in testDecoder self.assertEquals(d.decode(input, eof), output) AssertionError: u'o.i.a.b.c.d.' != u'abcd.'

But strange, I cannot see this error on python.org buildbot. ???



More information about the Python-Dev mailing list