Issue1662920

classification
Title: PyList doesn't change into byte[]
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, nhiro
Priority: normal Keywords:

Created on 2007-02-18.17:15:29 by nhiro, last changed 2007-04-25.05:30:35 by cgroves.

Messages
msg1488 (view) Author: NISHIO Hirokazu (nhiro) Date: 2007-02-18.17:15:29
When I call a function which take byte[] as its argument
(for example javax.sound.midi.SysexMessage#	setMessage(int status, byte[] data, int length))

>>> import javax.sound.midi.SysexMessage as S
>>> s = S()
>>> s.setMessage(0xF0, [0x7E, 0xFF, 0x09, 0x01, 0xF7], 5)

it throws an error.

TypeError: setMessage(): 2nd arg can't be coerced to byte[]

This code works well on jython2.1.
msg1489 (view) Author: Charlie Groves (cgroves) Date: 2007-02-20.06:31:24
Did you submit this as deferred for a reason?  It seems like something we should get for the 2.2 release to me.
msg1490 (view) Author: NISHIO Hirokazu (nhiro) Date: 2007-02-20.08:50:52
Sorry, I misundersttod the word 'deffered' like 'defect'.
msg1491 (view) Author: Charlie Groves (cgroves) Date: 2007-02-20.16:38:15
Ahh, gotcha.  I'm moving this to be fixed for beta2 then.
msg1492 (view) Author: Charlie Groves (cgroves) Date: 2007-04-25.05:30:35
This is failing because 0xFF and 0xF7 are both greater than 127, the largest value you can store in a byte in Java.  As such, I'm not sure this is actually a bug even though it's different than jython2.1.  I think it's better to only allow Java bytes, values from -128 to 127, rather than doing the more Pythonic thing and making bytes from 0-255 since we're converting to a Java type.  
History
Date User Action Args
2007-02-18 17:15:29nhirocreate