Commits

Amaury Forgeot d'Arc  committed 4deadf4

mmap.error is OSError

  • Participants
  • Parent commits b8bb27a
  • Branches py3.3

Comments (0)

Files changed (3)

File pypy/module/mmap/__init__.py

         'ACCESS_WRITE': 'space.wrap(interp_mmap.ACCESS_WRITE)',
         'ACCESS_COPY' : 'space.wrap(interp_mmap.ACCESS_COPY)',
         'mmap': 'interp_mmap.W_MMap',
-        'error': 'space.fromcache(interp_mmap.Cache).w_error',
+        'error': 'space.w_OSError',
     }
 
     appleveldefs = {

File pypy/module/mmap/interp_mmap.py

 ACCESS_WRITE = rmmap.ACCESS_WRITE
 ACCESS_COPY  = rmmap.ACCESS_COPY
 
-class Cache:
-    def __init__(self, space):
-        self.w_error = space.new_exception_class("mmap.error",
-                                                 space.w_EnvironmentError)
 
 def mmap_error(space, e):
     if isinstance(e, RValueError):
         return OperationError(space.w_TypeError,
                               space.wrap(e.message))
     elif isinstance(e, OSError):
-        w_error = space.fromcache(Cache).w_error
-        return wrap_oserror(space, e, w_exception_class=w_error)
+        return wrap_oserror(space, e)
     else:
         # bogus 'e'?
         return OperationError(space.w_SystemError, space.wrap('%s' % e))

File pypy/module/mmap/test/test_mmap.py

             assert isinstance(mmap.PROT_READ, int)
             assert isinstance(mmap.PROT_WRITE, int)
 
-        assert 'mmap.error' in str(mmap.error)
-        assert mmap.error is not EnvironmentError
-        assert issubclass(mmap.error, EnvironmentError)
+        assert mmap.error is OSError
 
     def test_args(self):
         from mmap import mmap