[pypy-svn] r34366 - in pypy/dist/pypy/rpython: . test

arigo at codespeak.net arigo at codespeak.net
Wed Nov 8 14:37:51 CET 2006


Author: arigo
Date: Wed Nov  8 14:37:50 2006
New Revision: 34366

Modified:
   pypy/dist/pypy/rpython/rmodel.py
   pypy/dist/pypy/rpython/test/test_rstr.py
Log:
A test that passes anyway, and a fix for some other problem that is quite
hard to test explicitly :-(


Modified: pypy/dist/pypy/rpython/rmodel.py
==============================================================================
--- pypy/dist/pypy/rpython/rmodel.py	(original)
+++ pypy/dist/pypy/rpython/rmodel.py	Wed Nov  8 14:37:50 2006
@@ -198,7 +198,8 @@
             raise TyperError("getattr() with a non-constant attribute name")
 
     def rtype_str(self, hop):
-        return hop.gendirectcall(self.ll_str, hop.args_v[0])
+        [v_self] = hop.inputargs(self)
+        return hop.gendirectcall(self.ll_str, v_self)
 
     def rtype_nonzero(self, hop):
         return self.rtype_is_true(hop)   # can call a subclass' rtype_is_true()

Modified: pypy/dist/pypy/rpython/test/test_rstr.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rstr.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rstr.py	Wed Nov  8 14:37:50 2006
@@ -573,6 +573,13 @@
         res = self.interpret(fn, [1])
         assert typeOf(res) == Signed
 
+    def test_call_str_on_string(self):
+        def fn(i):
+            s = "x" * i
+            return str(s)
+        res = self.interpret(fn, [3])
+        assert self.ll_to_string(res) == 'xxx'
+
 
 def FIXME_test_str_to_pystringobj():
     def f(n):



More information about the Pypy-commit mailing list