[MATRIX-SIG] umathmodule and exceptions

David Ascher da@skivs.ski.org
Thu, 19 Feb 1998 09:40:03 -0800 (PST)


On Thu, 19 Feb 1998, Shashank Mallick wrote:

> I'm using the umath module to perform numerical computations on user-defined
> types. I ran into the following behavior, which I feel is a bug in the umath
> module.

Hi Shashank (remember me?).


> >>> import math
> >>> math.cos(test)
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> TypeError: illegal argument type for built-in operation
> >>> import umath
> WARNING: Python C API version mismatch for module umath:
>   This Python has API version 1007, module umath has version 1006.
> >>> umath.cos(test)
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> AttributeError: cos
> >>>
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> This is clearly a TypeError and I see no reason why an AttributeError is
> raised when I perform this operation. 

I'm not so sure it's a TypeError -- what it looks like to me is that
there's something wrong with your umath configuration.  The AttributeError
is saying that there is no 'cos' attribute in the umath module.  Do a
dir(umath) and see what comes back...

But regardless of that, I'm very suspicious of the API version mismatch,
which you shouldn't be getting.  Sounds to me like a recompile is needed.

--david


_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________