[Numpy-discussion] fwrite() failure in PyArray_ToFile

Charles R Harris charlesr.harris@gmail....
Fri Sep 4 17:13:31 CDT 2009


On Fri, Sep 4, 2009 at 3:54 PM, David Warde-Farley <dwf@cs.toronto.edu>wrote:

> On 4-Sep-09, at 4:23 PM, Charles R Harris wrote:
>
> > The odd values might be from the format code in the error message:
> >
> >                PyErr_Format(PyExc_ValueError,
> >                        "%ld requested and %ld written",
> >                        (long) size, (long) n);
> >
> > The code that is immediately responsible for the write is in lines
> > 79-92 of
> > convert.c. You could do a bit of poking around in there to find out
> > what is
> > happening.
>
>
> Yes, I saw that. My C is rusty, but wouldn't the cast take care of it?
> n is of type size_t, which is pretty big, and a cast to long shouldn't
> be an issue. And if (hopefully) PyErr_Format is correct...
>
>
Well, I don't have access, but this smells like an overflow problem. It
would be nice to know what the actual sizes of the numbers are.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090904/5ae393d8/attachment.html 


More information about the NumPy-Discussion mailing list