New issue 2760: getattr lookup difference in numpy/cpyext https://bitbucket.org/pypy/pypy/issues/2760/getattr-lookup-difference-in-numpy-cpyext
pv: Consider the following code: ``` import numpy as np class Passthrough(object): def __init__(self, data): self.data = data def __getattr__(self, name): print("GETATTR:", name) return getattr(self.data, name) x = Passthrough(np.array([1])) print("GOT:", np.array(x)) ``` On CPython this prints ``` GETATTR: __array_struct__ GOT: [1] ``` On pypy3-5.10.1 and pypy2-5.10.0 it prints ``` GOT: <__main__.Passthrough object at 0x0000000001776aa0> ``` The relevant Numpy code where it tries to look up the attribute is here: [PyArray_LookupSpecial_OnInstance](https://github.com/numpy/numpy/blob/1ee1a4ac7f79e8c707c416f81f049fd3ac94f1e6/numpy/core/src/private/get_attr_string.h#L119), [PyArray_FromStructInterface](https://github.com/numpy/numpy/blob/1ee1a4ac7f79e8c707c416f81f049fd3ac94f1e6/numpy/core/src/multiarray/ctors.c#L2082), [PyArray_GetArrayParamsFromObject](https://github.com/numpy/numpy/blob/1ee1a4ac7f79e8c707c416f81f049fd3ac94f1e6/numpy/core/src/multiarray/ctors.c#L1500) Looks mightily suspicious, but is it a cpyext or Numpy issue? (In other news, scipy test suite has 6 remaining failures (out of 12000+ tests) on pypy3, two of them due to the above.) _______________________________________________ pypy-issue mailing list pypy-issue@python.org https://mail.python.org/mailman/listinfo/pypy-issue