If we want to change the signature -- and that seems like the easiest way
to avoid gratuitous big-data bugs in the 'len' argument here and generally
avoid ugly casts -- then by far the easiest way to do *that* is to change
the name of the function. And PyArray_ConvertIndexSequence or
PyArray_IntpFromIndexSequence or something is probably a better name than
what we have now, so eh, it seems like an easy improvement to me. Am I
missing something that makes it difficult or annoying?


On Fri, Apr 19, 2013 at 5:41 PM, seberg <notifications@github.com> wrote:

> In numpy/core/src/multiarray/conversion_utils.c:
>
> > @@ -117,7 +118,7 @@
> >          }
> >      }
> >      seq->len = len;
> > -    nd = PyArray_IntpFromSequence(obj, (npy_intp *)seq->ptr, len);
> > +    nd = PyArray_IntpFromSequence(obj, (npy_intp *)seq->ptr, (int) len);
>
> Well, within numpy it is only used for "index" type objects, where you
> want only objects that can be safely cast to integers. I guess nobody can
> know if there is no usage out there that sees it as a generic (unsafe)
> sequence-to-integer converter...
>
> To be honest, I don't quite see what would be the best way to clear this.
> I could create a PyArray_IntpFromIndexSequence or such for private use, but
> not sure about the name, nor if its even worth it (it really is used in 5
> places or so, and half of them are within conversion_utils).
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/numpy/numpy/pull/3243/files#r3876965>
> .
>