1.1 --- a/generator.py Tue Jun 29 22:41:05 2021 +0200
1.2 +++ b/generator.py Tue Jun 29 23:50:13 2021 +0200
1.3 @@ -46,7 +46,7 @@
1.4 int_type = "__builtins__.int.int"
1.5 list_type = "__builtins__.list.list"
1.6 none_type = "__builtins__.none.NoneType"
1.7 - string_type = "__builtins__.str.string"
1.8 + string_type = "__builtins__.str.str"
1.9 tuple_type = "__builtins__.tuple.tuple"
1.10 type_type = "__builtins__.core.type"
1.11 unicode_type = "__builtins__.unicode.unicode"
1.12 @@ -1215,6 +1215,21 @@
1.13 encode_instantiator_pointer(path),
1.14 )
1.15
1.16 + # Special-case the string types.
1.17 +
1.18 + # Here, the __builtins__.str.new_str function is called with the
1.19 + # initialiser's parameter.
1.20 +
1.21 + elif path == self.string_type:
1.22 + print >>f_code, """\
1.23 +__attr %s(__attr __self, __attr obj)
1.24 +{
1.25 + return __fn___builtins___str_new_str(__NULL, obj);
1.26 +}
1.27 +""" % (
1.28 + encode_instantiator_pointer(path),
1.29 + )
1.30 +
1.31 # Generic instantiation support.
1.32
1.33 else:
1.34 @@ -1285,6 +1300,6 @@
1.35
1.36 return 0;
1.37 }
1.38 -""" % encode_function_pointer("__builtins__.str.str")
1.39 +""" % encode_instantiator_pointer("__builtins__.str.str")
1.40
1.41 # vim: tabstop=4 expandtab shiftwidth=4