Commit 94687bdb authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #682 from kmod/instancemethod_getattr_fix

Fix irgen bug for instancemethods
parents f7546648 3fb60317
......@@ -206,7 +206,17 @@ public:
const std::vector<BoxedString*>*);
pyston_call tpp_call;
bool hasGenericGetattr() { return tp_getattr == NULL; }
bool hasGenericGetattr() {
if (tp_getattr)
return false;
// instancemethod_cls should have a custom tp_getattr but is currently implemented
// as a hack within getattrInternalGeneric
if (this == instancemethod_cls)
return false;
return true;
}
void freeze();
......
......@@ -37,3 +37,9 @@ print type(C().foo.im_func), type(C().foo.__func__)
print type(C().foo.im_self), type(C().foo.__self__)
print type(C().foo.im_class)
print repr(C().foo)
def f(m):
print m.__name__
f(C.foo)
f(C().foo)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment