Open rbtcollins opened 8 years ago
I was looking into why this is occurring and possible create a fix, but I got stuck for the moment. It seems that the behaviour for _get_user_defined_method is different for the different implementations, but my python voodoo isn't strong enough to come up with a solution atm. I'm checking with the pypy devs why the behaviour is different.
This is the simplified testcase:
import types
class Foo(object):
def __call__(self, a):
pass
meth = getattr(Foo, "__call__")
w = type(type.__call__)
m = type(all.__call__)
n = (w, m, types.BuiltinFunctionType)
print(isinstance(meth, w))
print(isinstance(meth, m))
print(isinstance(meth, types.BuiltinFunctionType))
print(isinstance(meth, n))
Output:
$ pypy test-pypy3.py
True
True
False
True
$ python2.7 test-pypy3.py
False
False
False
False
$ pypy3 test-pypy3.py
True
False
False
True
$ python3 test-pypy3.py
False
False
False
False
I checked on #pypy where I was pointed to this page which mentions differences in the inspect module:
http://doc.pypy.org/en/latest/cpython_differences.html#miscellaneous
BTW: the reason it works on pypy is because the failing tests are being ignored by the sys.version_info[0] > 2 check.
From aliles/funcsigs#18, filed by @jlec