[pypy-svn] r71821 - pypy/trunk/pypy/module/mmap

arigo at codespeak.net arigo at codespeak.net
Fri Mar 5 18:31:22 CET 2010


Author: arigo
Date: Fri Mar  5 18:31:21 2010
New Revision: 71821

Modified:
   pypy/trunk/pypy/module/mmap/interp_mmap.py
Log:
Capture and expose the RPython-level OSError exception.
I cannot really be sure that it's complete, and it's
all hard-to-test cases :-(


Modified: pypy/trunk/pypy/module/mmap/interp_mmap.py
==============================================================================
--- pypy/trunk/pypy/module/mmap/interp_mmap.py	(original)
+++ pypy/trunk/pypy/module/mmap/interp_mmap.py	Fri Mar  5 18:31:21 2010
@@ -54,7 +54,10 @@
     tell.unwrap_spec = ['self']
     
     def descr_size(self):
-        return self.space.wrap(self.mmap.file_size())
+        try:
+            return self.space.wrap(self.mmap.file_size())
+        except OSError, e:
+            raise wrap_oserror(self.space, e, 'w_EnvironmentError')
     descr_size.unwrap_spec = ['self']
     
     def write(self, data):
@@ -83,6 +86,8 @@
         except RValueError, v:
             raise OperationError(self.space.w_ValueError,
                                  self.space.wrap(v.message))
+        except OSError, e:
+            raise wrap_oserror(self.space, e, 'w_EnvironmentError')
     flush.unwrap_spec = ['self', int, int]
     
     def move(self, dest, src, count):
@@ -96,7 +101,10 @@
     def resize(self, newsize):
         self.check_valid()
         self.check_resizeable()
-        self.mmap.resize(newsize)
+        try:
+            self.mmap.resize(newsize)
+        except OSError, e:
+            raise wrap_oserror(self.space, e, 'w_EnvironmentError')
     resize.unwrap_spec = ['self', int]
     
     def __len__(self):



More information about the Pypy-commit mailing list