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

# 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. ???

On Fri, May 2, 2008 at 11:47 AM, ocean wrote:
# 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.
The buildbots don't fail, because StatefulIncrementalDecoderTest is not listed in the run_unittest() call :-(. I found the cause of the problem: in io.py, TextIOWrapper.tell() calls decode() with a bytearray, without any reason it seems. I will take care of this tonight, if bugs.python.org is available. -- Amaury Forgeot d'Arc

On Fri, May 2, 2008 at 2:47 AM, ocean <ocean@m2.ccsnet.ne.jp> wrote:
# I tried to post this to bug tracker, but couldn't, so posted here...
Was this because you can't figure out how to get a username, or because it was down? It's up now; to create a username, use this form: http://bugs.python.org/user?@template=register (most fields are optional :-). -- --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (3)
-
Amaury Forgeot d'Arc
-
Guido van Rossum
-
ocean