[Numpy-discussion] Questions about the array interface.
xscottg at yahoo.com
Fri Apr 8 11:14:27 EDT 2005
--- "David M. Cooke" <cookedm at physics.mcmaster.ca> wrote:
> > Oh, one other nitpicky thing, I think PyLong_AsLongLong needs some sort
> > of error checking (it can allegedly raise errors). I suppose that means
> > one is supposed to call PyError_Occurred after every call? That's sort
> > of painful!
> Yes! Check all C API functions that may return errors! That includes
> PySequence_GetItem() and PyLong_AsLongLong.
Sorry, I should have been clear that I was writing example code. I only
put the error checking in where I thought it was demonstrating the point.
I'd be surprized if it even compiled...
Note that the additional error checking is required in the "success" path
where the attributes are present. In other words, mandating the attributes
be there when they aren't strictly required could make things slower...
More information about the NumPy-Discussion