[Numpy-discussion] fwrite() failure in PyArray_ToFile
Charles R Harris
Fri Sep 4 17:13:31 CDT 2009
On Fri, Sep 4, 2009 at 3:54 PM, David Warde-Farley <email@example.com>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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion