Title: bytearray does not support '+' or .join()
Type: crash Severity: normal
Components: Core Versions: 2.7a1
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: fwierzbicki, jeff.allen, oscar
Priority: high Keywords:

Created on 2012-05-24.20:16:12 by oscar, last changed 2012-09-07.22:54:49 by jeff.allen.

msg7138 (view) Author: Oscar (oscar) Date: 2012-05-24.20:16:11
behavior of bytearray does not match python2.7

Jython 2.7a1 (default:4f5e3c12edc0, May 16 2012, 13:40:33) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_04
Type "help", "copyright", "credits" or "license" for more information.
>>> a=bytearray(b'01')
>>> a
<bytearray object at 0x2>
>>> b=bytearray(b'23')
>>> b
<bytearray object at 0x3>
>>> a+b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'bytearray' and 'bytearray'

Python 2.7 (r27:82500, Sep 16 2010, 18:02:00) 
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a=bytearray(b'01')
>>> b=bytearray(b'23')
>>> a+b

bytearray in jython 2.7a1 is also missing the join method.
msg7139 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-05-24.20:38:08
If you look at the announcement and the README you'll see that we know bytearray is only partially implemented :) -- It's probably a good idea to have a bug report around though so others can see that it's being worked on.
msg7140 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-05-24.20:43:52
Jeff Allen (ja) is the one working on this.
msg7141 (view) Author: Oscar (oscar) Date: 2012-05-24.20:45:49
> If you look at the announcement and the README you'll see

My bad.
msg7142 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-05-24.20:47:41
Oscar: no worries! Bug reports are always appreciated - having this one exist may keep others from posting the same bug :)
msg7153 (view) Author: Jeff Allen (jeff.allen) Date: 2012-05-25.21:50:32
There are so many things bytearray doesn't do yet (my bad), but I'm working on it. If it's any comfort:

Jython 2.7a1+ (, May 19 2012, 20:07:50)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_26
Type "help", "copyright", "credits" or "license" for more information.
>>> a=bytearray(b'01')
>>> b=bytearray(b'23')
>>> a+b

I believe that is in the development tip now. The rest is coming, well, most of it. Great to know people want it.
msg7455 (view) Author: Jeff Allen (jeff.allen) Date: 2012-09-07.22:54:48
bytearray is now complete with these operations, and all the others required of it.
Date User Action Args
2012-09-07 22:54:49jeff.allensetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg7455
2012-05-25 21:50:33jeff.allensetmessages: + msg7153
2012-05-24 20:47:42fwierzbickisetmessages: + msg7142
2012-05-24 20:45:49oscarsetmessages: + msg7141
2012-05-24 20:43:52fwierzbickisetassignee: jeff.allen
messages: + msg7140
nosy: + jeff.allen
2012-05-24 20:38:08fwierzbickisetpriority: high
resolution: accepted
messages: + msg7139
nosy: + fwierzbicki
2012-05-24 20:16:12oscarcreate