Reverted default value of unknown objects to None (PY-8703)

This reverts the effects of 16a8636bae4c5ac2ef5ab21e3a155adadd00e1ad, so a new fix for PY-7340 is required.
This commit is contained in:
Andrey Vlasovskikh
2013-02-06 16:40:47 +04:00
parent 0b9c257ad2
commit aa14a2edbb
3 changed files with 10 additions and 17 deletions
+3 -3
View File
@@ -24,7 +24,7 @@ but seemingly no one uses them in C extensions yet anyway.
# * re.search-bound, ~30% time, in likes of builtins and _gtk with complex docstrings.
# None of this can seemingly be easily helped. Maybe there's a simpler and faster parser library?
VERSION = "1.123" # Must be a number-dot-number string, updated with each change that affects generated skeletons
VERSION = "1.124" # Must be a number-dot-number string, updated with each change that affects generated skeletons
# Note: DON'T FORGET TO UPDATE!
import sys
@@ -1300,7 +1300,7 @@ class ModuleRedeclarator(object):
if found_name:
if found_name == as_name:
notice = " # (!) real value is %r" % s
s = "object()"
s = "None"
else:
notice = " # (!) forward: %s, real value is %r" % (found_name, s)
if SANE_REPR_RE.match(s):
@@ -1308,7 +1308,7 @@ class ModuleRedeclarator(object):
else:
if not found_name:
notice = " # (!) real value is %r" % s
out(indent, prefix, "object()", postfix, notice)
out(indent, prefix, "None", postfix, notice)
def getRetType(self, s):
+2 -2
View File
@@ -6,7 +6,7 @@
(default) 1.92 # anything not explicitly marked
(built-in) 1.123 # skeletons of all built-in modules are built together
(built-in) 1.124 # skeletons of all built-in modules are built together
# Note: modules like itertools, etc are "(built-in)" and are ignored if given separately
_fileio 1.101
@@ -15,7 +15,7 @@ sys 1.101
thread 1.102
_thread 1.102
_struct 1.103
datetime 1.121
datetime 1.124
PyQt4.Qsci 1.94
PyQt4.QtAssistant 1.94
@@ -48,8 +48,11 @@ public class PyTypeChecker {
if (expected == null || actual == null) {
return true;
}
if (isObjectType(expected) || isObjectType(actual)) {
return true;
if (expected instanceof PyClassType) {
final PyClass c = ((PyClassType)expected).getPyClass();
if (c != null && "object".equals(c.getName())) {
return true;
}
}
if ((expected instanceof PyTypeReference || actual instanceof PyTypeReference) && !recursive) {
return true;
@@ -158,16 +161,6 @@ public class PyTypeChecker {
return false;
}
private static boolean isObjectType(@NotNull PyType type) {
if (type instanceof PyClassType) {
final PyClass c = ((PyClassType)type).getPyClass();
if ("object".equals(c.getName())) {
return true;
}
}
return false;
}
public static boolean isUnknown(@Nullable PyType type) {
if (type == null || type instanceof PyTypeReference || type instanceof PyGenericType) {
return true;