[pypy-svn] r62512 - pypy/trunk/pypy/rpython/module

afa at codespeak.net afa at codespeak.net
Wed Mar 4 11:02:10 CET 2009


Author: afa
Date: Wed Mar  4 11:02:10 2009
New Revision: 62512

Modified:
   pypy/trunk/pypy/rpython/module/ll_os_stat.py
Log:
Correct the implementation of the fake implementation of os.stat:
it should return a STAT_STRUCT, not a LL_STAT_STRUCT which is used to call the libc stat() function.

This fixes the tests in rlib/test/test_rmmap.py


Modified: pypy/trunk/pypy/rpython/module/ll_os_stat.py
==============================================================================
--- pypy/trunk/pypy/rpython/module/ll_os_stat.py	(original)
+++ pypy/trunk/pypy/rpython/module/ll_os_stat.py	Wed Mar  4 11:02:10 2009
@@ -242,12 +242,15 @@
 
     def posix_fakeimpl(arg):
         st = getattr(os, name)(arg)
-        fields = [TYPE for fieldname, TYPE in LL_STAT_FIELDS]
+        fields = [TYPE for fieldname, TYPE in STAT_FIELDS]
         TP = TUPLE_TYPE(fields)
         ll_tup = lltype.malloc(TP.TO)
-        for i, (fieldname, TYPE) in enumerate(LL_STAT_FIELDS):
+        for i, (fieldname, TYPE) in enumerate(STAT_FIELDS):
             val = getattr(st, fieldname)
-            rffi.setintfield(ll_tup, 'item%d' % i, int(val))
+            if isinstance(TYPE, lltype.Number):
+                rffi.setintfield(ll_tup, 'item%d' % i, int(val))
+            else:
+                setattr(ll_tup, 'item%d' % i, val)
         return ll_tup
 
     if arg_is_path:



More information about the Pypy-commit mailing list