1.1 --- a/generator.py Sat Dec 10 14:04:01 2016 +0100
1.2 +++ b/generator.py Sat Dec 10 17:32:16 2016 +0100
1.3 @@ -19,7 +19,7 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from common import CommonOutput
1.8 +from common import CommonOutput, get_builtin_module, get_builtin_type
1.9 from encoders import encode_bound_reference, encode_function_pointer, \
1.10 encode_instantiator_pointer, \
1.11 encode_literal_constant, encode_literal_constant_member, \
1.12 @@ -446,8 +446,8 @@
1.13
1.14 # NOTE: This makes assumptions about the __builtins__ structure.
1.15
1.16 - modname = value.__class__.__name__
1.17 - typename = modname == "str" and "string" or modname
1.18 + typename = get_builtin_type(value.__class__.__name__)
1.19 + modname = get_builtin_module(typename)
1.20 ref = Reference("<instance>", "__builtins__.%s.%s" % (modname, typename))
1.21
1.22 self.make_constant(f_decls, f_defs, ref, const_path, structure_name, value)