[Numpy-discussion] How to handle a busted API?

Robert Kern robert.kern@gmail....
Sun Jul 13 02:25:54 CDT 2008


On Sun, Jul 13, 2008 at 02:17, Charles R Harris
<charlesr.harris@gmail.com> wrote:
>
> On Sun, Jul 13, 2008 at 12:53 AM, Robert Kern <robert.kern@gmail.com> wrote:
>>
>> On Sun, Jul 13, 2008 at 01:49, Charles R Harris
>> <charlesr.harris@gmail.com> wrote:
>> >
>> > On Sun, Jul 13, 2008 at 12:02 AM, Robert Kern <robert.kern@gmail.com>
>> > wrote:
>>
>> >> Compile-time warnings will be ignored if they aren't errors that stop
>> >> the build. Run-time DeprecationWarnings are feasible:
>> >>
>> >>  http://docs.python.org/dev/c-api/exceptions.html#PyErr_WarnEx
>> >
>> > OK, will do. The same user wants to fix up fftpack_lite. This should
>> > actually be pretty easy, just replace all ints by longs in fftpack and
>> > fftpack_lite. Or maybe we should use one of the python.h types. As far
>> > as I
>> > know, these functions are only exposed through the python interface.
>>
>> Py_ssize_t and Py_size_t are probably the most appropriate, in this
>> case. long is not always the same size as a pointer address.
>
> I'll go with Py_ssize_t then, I'd have to vet the code before using an
> unsigned type. Hmm, I wonder if any of the npy types defined in terms of the
> corresponding python types? If not, npy_intp might be the best choice since
> it will be needed to create arrays.

Yes, npy_intp would probably be better from the reader's point of view.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco


More information about the Numpy-discussion mailing list