mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed false positive in callable inspection when __call__ is defined as an attribute (PY-8416)
This commit is contained in:
@@ -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
|
||||
+5
@@ -54,6 +54,11 @@ public class PyCallingNonCallableInspectionTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-8416
|
||||
public void testCallAttributeAssignment() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
setLanguageLevel(LanguageLevel.PYTHON27);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user