Hi,

I have found what I think are two bugs in the Jython 2.5 Alpha code for arrays.  The reason that I am writing here rather than making a bug report is that I am not positive they are bugs since arrays in Jython are a bit complicated (to me anyway).

The first question:

The following runnable short code snippet runs on both Jython and Python (I am running on Windows XP Pro) but gives slightly different results.

-----------------------------------------
import array

a = array.array("c", 'abc123')
print a
print a.tostring()
print


print repr(a.tostring())

for i in a:
    print i,
   
print

-----------------------------------------------

In Python 2.5.2 it prints the following:

    array('c', 'abc123')  # this is where they are different
    abc123

    'abc123'
    a b c 1 2 3

In Jython 2.5a1 it prints:

    array('c',['a', 'b', 'c', '1', '2', '3'])  # this is where they are different
    abc123

    'abc123'
    a b c 1 2 3


Intuitively, the Jython result seems right, an array of char.  But, my understanding of char in Python says that the Jython is wrong.  I think a Python char is 1 or more characters, in other words a string.  the Jython char array is actually several char arrays rather than one char array.


The other problem is unsigned char  -  using a 'B' as the type code.  I receive the following error message in Jython when declaring an array with the 'B' type code ( 'b' - signed char - works ok):


 Traceback (most recent call last):
  File "C:\...\src\charArraysUnsigned.py", line 6, in <module>
    a = array.array("B", 'abc123')
ValueError: typecode must be in [zcbhilfd]

The following very short code snippet should recreate the error in Jython:

---------------------------------
import array

a = array.array("B", 'abc123')

---------------------------------------

I'll open bug reports if someone will confirm that these are bugs and not something that needed to be done to get Java and Python working together.

Thanks,
  Bob