1.1 --- a/common.py Sat Feb 04 15:35:58 2017 +0100
1.2 +++ b/common.py Sat Feb 04 16:28:15 2017 +0100
1.3 @@ -1237,21 +1237,22 @@
1.4 return assigned
1.5
1.6 # Type and module functions.
1.7 +# NOTE: This makes assumptions about the __builtins__ structure.
1.8
1.9 def get_builtin_module(name):
1.10
1.11 "Return the module name containing the given type 'name'."
1.12
1.13 - # NOTE: This makes assumptions about the __builtins__ structure.
1.14 -
1.15 if name == "string":
1.16 - return "str"
1.17 + modname = "str"
1.18 elif name == "utf8string":
1.19 - return "unicode"
1.20 + modname = "unicode"
1.21 elif name == "NoneType":
1.22 - return "none"
1.23 + modname = "none"
1.24 else:
1.25 - return name
1.26 + modname = name
1.27 +
1.28 + return "__builtins__.%s" % modname
1.29
1.30 def get_builtin_type(name):
1.31
1.32 @@ -1264,6 +1265,14 @@
1.33 else:
1.34 return name
1.35
1.36 +def get_builtin_class(name):
1.37 +
1.38 + "Return the full name of the built-in class having the given 'name'."
1.39 +
1.40 + typename = get_builtin_type(name)
1.41 + module = get_builtin_module(typename)
1.42 + return "%s.%s" % (module, typename)
1.43 +
1.44 # Useful data.
1.45
1.46 predefined_constants = "False", "None", "NotImplemented", "True"