[pypy-svn] r44361 - in pypy/dist/pypy/rpython: lltypesystem module

fijal at codespeak.net fijal at codespeak.net
Tue Jun 19 10:42:30 CEST 2007


Author: fijal
Date: Tue Jun 19 10:42:30 2007
New Revision: 44361

Modified:
   pypy/dist/pypy/rpython/lltypesystem/rfficache.py
   pypy/dist/pypy/rpython/module/ll_os.py
Log:
A bit better fix to deal with mode_t, need windows tester.


Modified: pypy/dist/pypy/rpython/lltypesystem/rfficache.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rfficache.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/rfficache.py	Tue Jun 19 10:42:30 2007
@@ -47,7 +47,7 @@
     for name in (_name, 'unsigned ' + _name):
         TYPES.append(name)
 TYPES += ['long long', 'unsigned long long', 'size_t']
-if os.name == 'posix':
+if sys.platform != 'nt':
     TYPES.append('mode_t')
 
 def newline_repr(d):

Modified: pypy/dist/pypy/rpython/module/ll_os.py
==============================================================================
--- pypy/dist/pypy/rpython/module/ll_os.py	(original)
+++ pypy/dist/pypy/rpython/module/ll_os.py	Tue Jun 19 10:42:30 2007
@@ -19,6 +19,7 @@
 # 'suggested_primitive' flag is set to another function, if the conversion
 # and buffer preparation stuff is not useful.
 
+import sys
 import os
 from pypy.rpython.module.support import ll_strcpy, _ll_strfill
 from pypy.rpython.module.support import to_opaque_object, from_opaque_object
@@ -117,12 +118,17 @@
     path = rffi.charp2str(l_path)
     return os.open(path, flags, mode)
 
-os_open = rffi.llexternal('open', [rffi.CCHARP, lltype.Signed, rffi.MODE_T],
+if sys.platform == 'nt':
+    mode_t = lltype.Signed
+else:
+    mode_t = rffi.MODE_T
+
+os_open = rffi.llexternal('open', [rffi.CCHARP, lltype.Signed, mode_t],
                           lltype.Signed, _callable=fake_os_open)
 
 def os_open_lltypeimpl(path, flags, mode):
     l_path = rffi.str2charp(path)
-    mode = lltype.cast_primitive(rffi.MODE_T, mode)
+    mode = lltype.cast_primitive(mode_t, mode)
     result = os_open(l_path, flags, mode)
     lltype.free(l_path, flavor='raw')
     if result == -1:



More information about the Pypy-commit mailing list