mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed callable inspection for return values of getattr() (PY-7625)
This commit is contained in:
@@ -62,7 +62,7 @@ __builtin__.filter.3 = \
|
||||
|
||||
__builtin__.getattr = \
|
||||
:type name: string \n\
|
||||
:rtype: unknown \n\
|
||||
:rtype: object or unknown \n\
|
||||
|
||||
__builtin__.globals = \
|
||||
:rtype: dict of (bytes, object)
|
||||
@@ -129,7 +129,7 @@ __builtin__.reduce = \
|
||||
:type function: collections.Callable \n\
|
||||
:type sequence: collections.Iterable \n\
|
||||
:type initial: object or None \n\
|
||||
:rtype: unknown \n\
|
||||
:rtype: object or unknown \n\
|
||||
|
||||
__builtin__.round = \
|
||||
:type number: int or long or float \n\
|
||||
@@ -1073,7 +1073,7 @@ __builtin__.tuple.__rmul__ = \
|
||||
|
||||
__builtin__.tuple.__getitem__ = \
|
||||
:type y: int \n\
|
||||
:rtype: unknown \n\
|
||||
:rtype: object or unknown \n\
|
||||
|
||||
|
||||
## 5.8 Mapping types
|
||||
@@ -2877,7 +2877,7 @@ subprocess.Popen.send_signal = \
|
||||
json.loads = \
|
||||
:type s: string \n\
|
||||
:type encoding: string \n\
|
||||
:rtype: unknown \n\
|
||||
:rtype: object or unknown \n\
|
||||
|
||||
|
||||
## 18.12. base64
|
||||
|
||||
@@ -438,16 +438,17 @@ public class PyTypeChecker {
|
||||
}
|
||||
}
|
||||
else if (type instanceof PyUnionType) {
|
||||
Boolean result = true;
|
||||
for (PyType member : ((PyUnionType)type).getMembers()) {
|
||||
final Boolean result = isCallable(member);
|
||||
if (result == null) {
|
||||
final Boolean callable = isCallable(member);
|
||||
if (callable == null) {
|
||||
return null;
|
||||
}
|
||||
else if (!result) {
|
||||
return false;
|
||||
else if (!callable) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
else if (type instanceof PyCallableType) {
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class value():
|
||||
pass
|
||||
|
||||
class MyClass(object):
|
||||
def bar(self):
|
||||
foo = getattr(self, 'foo')
|
||||
foo()
|
||||
+5
@@ -64,6 +64,11 @@ public class PyCallingNonCallableInspectionTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-8182
|
||||
public void testGetattrCallable() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
setLanguageLevel(LanguageLevel.PYTHON27);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user