[pypy-svn] r48336 - in pypy/branch/pypy-rpython-unicode/rpython: . test

fijal at codespeak.net fijal at codespeak.net
Tue Nov 6 13:24:09 CET 2007


Author: fijal
Date: Tue Nov  6 13:24:09 2007
New Revision: 48336

Modified:
   pypy/branch/pypy-rpython-unicode/rpython/rstr.py
   pypy/branch/pypy-rpython-unicode/rpython/test/test_rstr.py
Log:
simplify code, as mixing unicode and strings are forbidden


Modified: pypy/branch/pypy-rpython-unicode/rpython/rstr.py
==============================================================================
--- pypy/branch/pypy-rpython-unicode/rpython/rstr.py	(original)
+++ pypy/branch/pypy-rpython-unicode/rpython/rstr.py	Tue Nov  6 13:24:09 2007
@@ -298,19 +298,12 @@
             return hop.gendirectcall(r_str.ll.ll_stringslice_minusone, v_str)
         raise TyperError(r_slic)
 
-def most_general_strrepr(repr1, repr2, rtyper):
-    string_repr = rtyper.type_system.rstr.string_repr
-    if repr1 is string_repr and repr2 is string_repr:
-        return string_repr
-    return rtyper_type_system.rstr.unicode_repr
-
 class __extend__(pairtype(AbstractStringRepr, AbstractStringRepr)):
     def rtype_add((r_str1, r_str2), hop):
         str1_repr = r_str1.repr
         str2_repr = r_str2.repr
         if hop.s_result.is_constant():
-            res_repr = most_general_strrepr(str1_repr, str2_repr, hop.rtyper)
-            return hop.inputconst(res_repr, hop.s_result.const)
+            return hop.inputconst(str1_repr, hop.s_result.const)
         v_str1, v_str2 = hop.inputargs(str1_repr, str2_repr)
         return hop.gendirectcall(r_str1.ll.ll_strconcat, v_str1, v_str2)
     rtype_inplace_add = rtype_add

Modified: pypy/branch/pypy-rpython-unicode/rpython/test/test_rstr.py
==============================================================================
--- pypy/branch/pypy-rpython-unicode/rpython/test/test_rstr.py	(original)
+++ pypy/branch/pypy-rpython-unicode/rpython/test/test_rstr.py	Tue Nov  6 13:24:09 2007
@@ -64,8 +64,8 @@
     def test_concat(self):
         const = self.const
         def fn(i, j):
-            s1 = [const(''), 'a', const('ab')]
-            s2 = [const(''), const('x'), 'xy']
+            s1 = [const(''), const('a'), const('ab')]
+            s2 = [const(''), const('x'), const('xy')]
             return s1[i] + s2[j]
         for i in range(3):
             for j in range(3):



More information about the Pypy-commit mailing list