Re: [Numpy-discussion] weird searchsorted behavior for unicode array

2012-03-29 Thread Thouis (Ray) Jones
It seems to be a bug in the unicode string length computation in arraytypes.c.src:UNICODE_compare(), based on comparison to the code in arrayobject.c:_myunicmp() and arrayobject.c:_compare_strings(). Patch below (against maintenance/1.6.x, but the bug also looks to be present in master based on

Re: [Numpy-discussion] weird searchsorted behavior for unicode array

2012-03-29 Thread Thouis (Ray) Jones
On Thu, Mar 29, 2012 at 11:04, Thouis (Ray) Jones tho...@gmail.com wrote: It seems to be a bug in the unicode string length computation in arraytypes.c.src:UNICODE_compare(), based on comparison to the code in arrayobject.c:_myunicmp() and arrayobject.c:_compare_strings(). Patch below

[Numpy-discussion] weird searchsorted behavior for unicode array

2012-03-28 Thread Thouis (Ray) Jones
I am seeing some very strange behavior searching a unicode array. The attached code outputs the following: UNICODE Is sorted: True Search sorted by iteration, left: [0, 1, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 13] Search sorted by iteration, right: [0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 13]

Re: [Numpy-discussion] weird searchsorted behavior for unicode array

2012-03-28 Thread josef . pktd
On Wed, Mar 28, 2012 at 10:55 AM, Thouis (Ray) Jones tho...@gmail.com wrote: I am seeing some very strange behavior searching a unicode array.  The attached code outputs the following: UNICODE Is sorted: True Search sorted by iteration, left: [0, 1, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 13]

Re: [Numpy-discussion] weird searchsorted behavior for unicode array

2012-03-28 Thread josef . pktd
On Wed, Mar 28, 2012 at 11:51 AM, josef.p...@gmail.com wrote: On Wed, Mar 28, 2012 at 10:55 AM, Thouis (Ray) Jones tho...@gmail.com wrote: I am seeing some very strange behavior searching a unicode array.  The attached code outputs the following: UNICODE Is sorted: True Search sorted by