[pypy-commit] pypy use-file-star-for-file: (arigo) simplify

fijal noreply at buildbot.pypy.org
Wed Aug 20 15:09:05 CEST 2014


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: use-file-star-for-file
Changeset: r72931:1c38dd6f99af
Date: 2014-08-20 15:07 +0200
http://bitbucket.org/pypy/pypy/changeset/1c38dd6f99af/

Log:	(arigo) simplify

diff --git a/rpython/rtyper/annlowlevel.py b/rpython/rtyper/annlowlevel.py
--- a/rpython/rtyper/annlowlevel.py
+++ b/rpython/rtyper/annlowlevel.py
@@ -421,13 +421,15 @@
                 return lltype_to_annotation(lltype.Ptr(UNICODE))
 
         def specialize_call(self, hop):
+            from rpython.rtyper.lltypesystem.rstr import (string_repr,
+                                                          unicode_repr)
             hop.exception_cannot_occur()
-            v_ll_str, = hop.inputargs(*hop.args_r)
-            if hop.args_r[0].lowleveltype == hop.r_result.lowleveltype:
-                return hop.genop('same_as', [v_ll_str],
-                                 resulttype = hop.r_result.lowleveltype)
+            if strtype is str:
+                v_ll_str = hop.inputarg(string_repr, 0)
             else:
-                return hop.gendirectcall(hop.args_r[0].ll.ll_chr2str, v_ll_str)
+                v_ll_str = hop.inputarg(unicode_repr, 0)
+            return hop.genop('same_as', [v_ll_str],
+                             resulttype = hop.r_result.lowleveltype)
         
     return hlstr, llstr
 


More information about the pypy-commit mailing list