[Numpy-discussion] Review of issue 825

Neil Muller drnlmuller+scipy@gmail....
Wed Jun 25 15:04:18 CDT 2008


On Wed, Jun 25, 2008 at 7:53 PM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
> But I wonder if this case isn't supposed to be caught by this
> fragment:
>
>     if (!PyArray_ISBEHAVED(ap)) {
>         buffer = _pya_malloc(mysize << 2);
>         if (buffer == NULL)
>             return PyErr_NoMemory();
>         alloc = 1;
>         memcpy(buffer, ip, mysize << 2);
>         if (!PyArray_ISNOTSWAPPED(ap)) {
>             byte_swap_vector(buffer, mysize, 4);
>         }
>     }

This actually works fine - the problem is immediately before this,
with the loop to find the end of the unicode string.

An alternative solution is to avoid the long pointer dptr entirely and
use a different approach to find the string length, but I worry that
that would obscure the intent of the code with very little positive
benefit.

-- 
Neil Muller
drnlmuller@gmail.com

I've got a gmail account. Why haven't I become cool?


More information about the Numpy-discussion mailing list