[pypy-svn] r48733 - pypy/dist/pypy/rpython/module

rxe at codespeak.net rxe at codespeak.net
Fri Nov 16 22:31:33 CET 2007


Author: rxe
Date: Fri Nov 16 22:31:33 2007
New Revision: 48733

Modified:
   pypy/dist/pypy/rpython/module/ll_os_stat.py
Log:
eventually figured oot memory corruption issues with os.stat and friends on llvm backend.  STRUCT_STAT is completely wrong since CConfig was not being called, and llvm backend actually uses STRUCT_STAT in malloc and call (c backend doesnt).  not sure what this would break by doing it by default so is conditional for someone else to fix :-)

Modified: pypy/dist/pypy/rpython/module/ll_os_stat.py
==============================================================================
--- pypy/dist/pypy/rpython/module/ll_os_stat.py	(original)
+++ pypy/dist/pypy/rpython/module/ll_os_stat.py	Fri Nov 16 22:31:33 2007
@@ -142,6 +142,19 @@
 else:
     _name_struct_stat = 'stat'
     INCLUDES = ['sys/types.h', 'sys/stat.h', 'unistd.h']
+
+# XXX need someone to look this over...
+hack_to_run_cconfig = False
+if hack_to_run_cconfig: 
+    from pypy.rpython.module.ll_os import CConfig 
+    from pypy.rpython.tool import rffi_platform as platform
+    class CConfig:
+        _includes_ = INCLUDES
+        LL_STRUCT = platform.Struct('struct stat', LL_STAT_FIELDS)
+    config = platform.configure(CConfig)
+    LL_STRUCT = config['LL_STRUCT']
+    LL_STAT_FIELDS = [(xname[2:], LL_STRUCT._flds[xname]) for xname in LL_STRUCT._names_without_voids()]
+
 STRUCT_STAT = rffi.CStructPtr(_name_struct_stat, *LL_STAT_FIELDS)
 
 



More information about the Pypy-commit mailing list