[pypy-svn] pypy default: Minor test and fix to be more 2.7-compliant.

arigo commits-noreply at bitbucket.org
Thu Feb 10 16:48:05 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41783:0401c84c6fd8
Date: 2011-02-10 15:42 +0100
http://bitbucket.org/pypy/pypy/changeset/0401c84c6fd8/

Log:	Minor test and fix to be more 2.7-compliant.

diff --git a/pypy/module/mmap/test/test_mmap.py b/pypy/module/mmap/test/test_mmap.py
--- a/pypy/module/mmap/test/test_mmap.py
+++ b/pypy/module/mmap/test/test_mmap.py
@@ -44,7 +44,7 @@
         raises(TypeError, mmap, 0, "foo")
              
         if os.name == "posix":
-            raises(TypeError, mmap, 0, 1, 2, 3, 4, 5)
+            raises(ValueError, mmap, 0, 1, 2, 3, 4)
             raises(TypeError, mmap, 0, 1, 2, 3, "foo", 5)
             raises(TypeError, mmap, 0, 1, foo="foo")
             raises((TypeError, OverflowError), mmap, 0, -1)

diff --git a/pypy/rlib/rmmap.py b/pypy/rlib/rmmap.py
--- a/pypy/rlib/rmmap.py
+++ b/pypy/rlib/rmmap.py
@@ -592,15 +592,15 @@
 
         fd = fileno
 
-        # check size boundaries
-        _check_map_size(length)
-        map_size = length
-
         # check access is not there when flags and prot are there
         if access != _ACCESS_DEFAULT and ((flags != MAP_SHARED) or\
                                           (prot != (PROT_WRITE | PROT_READ))):
             raise RValueError("mmap can't specify both access and flags, prot.")
 
+        # check size boundaries
+        _check_map_size(length)
+        map_size = length
+
         if access == ACCESS_READ:
             flags = MAP_SHARED
             prot = PROT_READ


More information about the Pypy-commit mailing list