Fixed false positive in callable inspection when __call__ is defined as an attribute (PY-8416)

This commit is contained in:
Andrey Vlasovskikh
2013-01-22 19:47:40 +04:00
parent 06c64f5c96
commit 9003881816
3 changed files with 15 additions and 1 deletions
@@ -85,6 +85,6 @@ public class PyABCUtil {
}
private static boolean hasMethod(PyClass cls, String name, boolean inherited) {
return cls.findMethodByName(name, inherited) != null;
return cls.findMethodByName(name, inherited) != null || cls.findClassAttribute(name, inherited) != null;
}
}
@@ -0,0 +1,9 @@
class C:
def f(self):
pass
__call__ = f
c = C()
c() # pass
@@ -54,6 +54,11 @@ public class PyCallingNonCallableInspectionTest extends PyTestCase {
doTest();
}
// PY-8416
public void testCallAttributeAssignment() {
doTest();
}
private void doTest() {
setLanguageLevel(LanguageLevel.PYTHON27);
try {