[pypy-svn] r46244 - in pypy/branch/pypy-more-rtti-inprogress/rpython/module: . test

arigo at codespeak.net arigo at codespeak.net
Sun Sep 2 19:56:10 CEST 2007


Author: arigo
Date: Sun Sep  2 19:56:09 2007
New Revision: 46244

Modified:
   pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py
   pypy/branch/pypy-more-rtti-inprogress/rpython/module/test/test_ll_os.py
Log:
test_ll_os.py passes on Windows.


Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py	(original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py	Sun Sep  2 19:56:09 2007
@@ -50,6 +50,11 @@
     SEEK_CUR = platform.DefinedConstantInteger('SEEK_CUR')
     SEEK_END = platform.DefinedConstantInteger('SEEK_END')
 
+if sys.platform.startswith('win'):
+    underscore_on_windows = '_'
+else:
+    underscore_on_windows = ''
+
 
 class RegisterOs(BaseLazyRegistering):
     _stringpolicy_ = 'fullauto'
@@ -467,11 +472,7 @@
 
     @registering(os.access)
     def register_os_access(self):
-        if sys.platform.startswith('win'):
-            name = '_access'
-        else:
-            name = 'access'
-        os_access = self.llexternal(name,
+        os_access = self.llexternal(underscore_on_windows + 'access',
                                     [rffi.CCHARP, rffi.INT],
                                     rffi.INT)
 
@@ -488,7 +489,7 @@
 
     @registering(os.getcwd)
     def register_os_getcwd(self):
-        os_getcwd = self.llexternal('getcwd',
+        os_getcwd = self.llexternal(underscore_on_windows + 'getcwd',
                                     [rffi.CCHARP, rffi.SIZE_T],
                                     rffi.CCHARP, stringpolicy='noauto')
 

Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/module/test/test_ll_os.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/module/test/test_ll_os.py	(original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/module/test/test_ll_os.py	Sun Sep  2 19:56:09 2007
@@ -51,6 +51,8 @@
 def test_os_wstar():
     from pypy.rpython.module.ll_os import RegisterOs
     for name in RegisterOs.w_star:
+        if not hasattr(os, name):
+            continue
         def fun(s):
             return getattr(os, name)(s)
 



More information about the Pypy-commit mailing list