[Numpy-discussion] fwrite() failure in PyArray_ToFile

David Warde-Farley dwf at cs.toronto.edu
Fri Sep 4 17:54:47 EDT 2009


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...

At any rate, I am without an account on those machines, so I will have  
to try and reproduce it elsewhere, or else do this in an extremely  
annoying fashion by proxy.

I should've mentioned this is with the 1.3.0 release, not that it's  
changed since.

David



More information about the NumPy-Discussion mailing list