[Numpy-discussion] bug triggered by array.astype()
Travis Oliphant
oliphant.travis at ieee.org
Sun Jan 29 00:52:01 CST 2006
Gerard Vermeulen wrote:
>>>>from numpy import *
>>>>core.__version__
>>>>
>>>>
>'0.9.5.2019'
>
>
>>>>v = linspace(0, 2*pi)
>>>>c = (255<<24)*cos(v) + (255<<16)*cos(v+2*pi/3) + (255<<8)*cos(v+4*pi/3) + 255
>>>>c.astype(UInt32)
>>>>
>>>>
>Traceback (most recent call last):
> File "<stdin>", line 1, in ?
>SystemError: Objects/longobject.c:257: bad argument to internal function
>
>
>
>
>
In SVN, now a Overflow error is raised instead in this example because
negative long integer objects are trying to be converted to unsigned
integers (this is a Python error being raised). We could check for this
and instead do what the c-compiler would do in converting from signed to
unsigned objects.
Is that preferrable?
-Travis
More information about the Numpy-discussion
mailing list