[Numpy-discussion] Python 3 porting

Charles R Harris charlesr.harris@gmail....
Mon Feb 15 16:51:09 CST 2010


On Mon, Feb 15, 2010 at 3:19 PM, Charles R Harris <charlesr.harris@gmail.com
> wrote:

>
>
> On Mon, Feb 15, 2010 at 3:05 PM, Pauli Virtanen <pav@iki.fi> wrote:
>
>> ma, 2010-02-15 kello 21:58 +0200, Pauli Virtanen kirjoitti:
>> [clip]
>> > > Program received signal SIGABRT, Aborted.
>> > > 0x00007fff84e1efe6 in __kill ()
>> > > (gdb) bt
>> > > #0  0x00007fff84e1efe6 in __kill ()
>> > > #1  0x00007fff84ebfe32 in abort ()
>> > > #2  0x00000001000cd715 in Py_FatalError ()
>> > > #3  0x0000000100069508 in unicode_dealloc ()
>> > > #4  0x000000010065cd1f in UNICODE_to_STRING (ip=0x101f06fd0 "a",
>> > > op=0x101f01470 "abc", n=4, aip=0x101ce5de8, aop=0x101901a28) at
>> > > arraytypes.c.src:1501
>> > > #5  0x00000001006771ca in PyArray_CastTo (out=0x101901a28,
>> > > mp=0x101ce5de8) at convert_datatype.c:336
>> > > #6  0x00000001006772e1 in PyArray_CastToType (mp=0x101ce5de8,
>> > > at=<value temporarily unavailable, due to optimizations>, fortran_=0)
>> > > at convert_datatype.c:73
>> > > #7  0x0000000100681569 in array_cast (self=0x101ce5de8, args=<value
>> > > temporarily unavailable, due to optimizations>) at methods.c:760
>> >
>> > The platform is OSX -- 32 or 64 bits? Is your Python unicode narrow or
>> > wide? Which test triggers the issue?
>>
>> Ok, I think I managed to nail that and all other remaining 64-bit
>> specific issues. Also Python 3.1.1's 2to3 should now work.
>>
>>
> Much better:
>
> FAILED (KNOWNFAIL=4, SKIP=4, errors=35, failures=51)
>
>
A lot of the remaining failures are of this sort:

 x: array([b'pi', b'pi', b'pi', b'four', b'five'],
      dtype='|S8')
 y: array(['pi', 'pi', 'pi', 'four', 'five'],
      dtype='<U4')


This looks fixable by specifying the dtype

>>> np.array([b'pi'])
array([b'pi'],
      dtype='|S2')
>>> np.array(['pi'])
array(['pi'],
      dtype='<U2')
>>> np.array(['pi'], dtype='|S2')
array([b'pi'],
      dtype='|S2')

I expect we will break a lot of code if b'pi' can't somehow be made the
default. Hmm. The 'b' prefix is an undocumented feature of python 2.6 but
doesn't work for earlier versions. But these tests can be fixed by being a
bit more explicit about the type.

More problematic are failing doctests, mostly because of unconverted print
statements.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100215/0bd67b77/attachment.html 


More information about the NumPy-Discussion mailing list