[pypy-svn] r47448 - pypy/dist/pypy/module/mmap

tismer at codespeak.net tismer at codespeak.net
Sun Oct 14 16:14:13 CEST 2007


Author: tismer
Date: Sun Oct 14 16:14:09 2007
New Revision: 47448

Modified:
   pypy/dist/pypy/module/mmap/interp_mmap.py
Log:
module/mmap passes all tests on windows

Modified: pypy/dist/pypy/module/mmap/interp_mmap.py
==============================================================================
--- pypy/dist/pypy/module/mmap/interp_mmap.py	(original)
+++ pypy/dist/pypy/module/mmap/interp_mmap.py	Sun Oct 14 16:14:09 2007
@@ -205,6 +205,7 @@
             space.wrap("memory mapped size is too large (limited by C int)"))
 
 if rmmap._POSIX:
+    
     def mmap(space, fileno, length, flags=rmmap.MAP_SHARED,
         prot=rmmap.PROT_WRITE | rmmap.PROT_READ, access=rmmap._ACCESS_DEFAULT):
 
@@ -218,9 +219,19 @@
         except RTypeError, e:
             raise OperationError(space.w_TypeError, space.wrap(e.message))
     mmap.unwrap_spec = [ObjSpace, int, 'index', int, int, int]
+
 elif rmmap._MS_WINDOWS:
-    def mmap(space, fileno, length, tagname="", access=_ACCESS_DEFAULT):
-        XXX
+
+    def mmap(space, fileno, length, tagname="", access=rmmap._ACCESS_DEFAULT):
+        try:
+            return space.wrap(W_MMap(space, rmmap.mmap(fileno, length,
+                                                       tagname, access)))
+        except REnvironmentError, e:
+            raise OperationError(space.w_EnvironmentError, space.wrap(e.message))
+        except RValueError, e:
+            raise OperationError(space.w_ValueError, space.wrap(e.message))
+        except RTypeError, e:
+            raise OperationError(space.w_TypeError, space.wrap(e.message))
     mmap.unwrap_spec = [ObjSpace, int, 'index', str, int]
 
 constants = rmmap.constants



More information about the Pypy-commit mailing list