[Numpy-discussion] Infinite recursion in numpy called from swig generated code

Travis Oliphant oliphant.travis at ieee.org
Tue Apr 18 13:50:09 CDT 2006

Robert Lupton wrote:
> The latest version of swig (1.3.28 or 1.3.29) has broken my
> multiple-inheritance-from-C-and-numpy application; more specifically,
> it generates an infinite loop in numpy-land.  I'm using numpy (0.9.6),
> and here's the offending code.  Ideas anyone? I've pasted the crucial
> part of numpy.lib.UserArray onto the end of this message (how do I know?
> because you can replace the "from numpy.lib.UserArray" with this, and
> the problem persists).
This is a problem in the getattr code of UserArray.   This is fixed in 
SVN.   But, you can just replace the getattr code in UserArray.py with 
the following:

    def __getattr__(self,attr):
        if (attr == 'array'):
            return object.__getattr__(self, attr)
        return self.array.__getattribute__(attr)

Thanks for finding and reporting this.


More information about the Numpy-discussion mailing list