[pypy-svn] r46343 - in pypy/dist/pypy/translator/sandbox: . test

arigo at codespeak.net arigo at codespeak.net
Wed Sep 5 14:23:07 CEST 2007


Author: arigo
Date: Wed Sep  5 14:23:06 2007
New Revision: 46343

Modified:
   pypy/dist/pypy/translator/sandbox/sandlib.py
   pypy/dist/pypy/translator/sandbox/test/test_sandbox.py
Log:
Fix the sandlib.


Modified: pypy/dist/pypy/translator/sandbox/sandlib.py
==============================================================================
--- pypy/dist/pypy/translator/sandbox/sandlib.py	(original)
+++ pypy/dist/pypy/translator/sandbox/sandlib.py	Wed Sep  5 14:23:06 2007
@@ -6,7 +6,7 @@
 
 import py
 import marshal, sys, os, posixpath, errno, stat
-from pypy.rpython.module.ll_os_stat import STAT_FIELDS, s_tuple_StatResult
+from pypy.rpython.module.ll_os_stat import s_StatResult
 from pypy.tool.ansi_print import AnsiLog
 from pypy.rlib.rarithmetic import r_longlong
 from py.compat import subprocess
@@ -273,16 +273,10 @@
         log.vpath('%r => %r' % (vpath, node))
         return node
 
-    def build_stat_result(self, st):
-        result = tuple(st)
-        result += (0,) * (len(STAT_FIELDS) - len(result))
-        return result
-
     def do_ll_os__ll_os_stat(self, vpathname):
         node = self.get_node(vpathname)
-        st = node.stat()
-        return self.build_stat_result(st)
-    do_ll_os__ll_os_stat.resulttype = s_tuple_StatResult
+        return node.stat()
+    do_ll_os__ll_os_stat.resulttype = s_StatResult
 
     do_ll_os__ll_os_lstat = do_ll_os__ll_os_stat
 

Modified: pypy/dist/pypy/translator/sandbox/test/test_sandbox.py
==============================================================================
--- pypy/dist/pypy/translator/sandbox/test/test_sandbox.py	(original)
+++ pypy/dist/pypy/translator/sandbox/test/test_sandbox.py	Wed Sep  5 14:23:06 2007
@@ -77,7 +77,7 @@
     assert tail == ""
 
 def test_sandbox_4():
-    from pypy.rpython.module.ll_os_stat import STAT_FIELDS, s_tuple_StatResult
+    from pypy.rpython.module.ll_os_stat import s_StatResult
     from pypy.rlib.rarithmetic import r_longlong
     r0x12380000007 = r_longlong(0x12380000007)
 
@@ -89,10 +89,9 @@
     t = Translation(entry_point, backend='c', standalone=True, sandbox=True)
     exe = t.compile()
     g, f = os.popen2(exe, "t", 0)
-    sttuple = (55, 0, 0, 0, 0, 0, 0x12380000007, 0, 0, 0)
-    sttuple += (0,) * (len(STAT_FIELDS)-len(sttuple))
-    expect(f, g, "ll_os.ll_os_stat", ("somewhere",), sttuple,
-           resulttype = s_tuple_StatResult)
+    st = os.stat_result((55, 0, 0, 0, 0, 0, 0x12380000007, 0, 0, 0))
+    expect(f, g, "ll_os.ll_os_stat", ("somewhere",), st,
+           resulttype = s_StatResult)
     expect(f, g, "ll_os.ll_os_ftruncate", (55, 0x12380000007), None)
     g.close()
     tail = f.read()


More information about the pypy-svn mailing list