Author: Amaury Forgeot d'Arc <[email protected]>
Branch: 
Changeset: r78068:1767d7627fba
Date: 2015-06-13 00:28 +0200
http://bitbucket.org/pypy/pypy/changeset/1767d7627fba/

Log:    Raises ValueError on os.major(-1)

diff --git a/pypy/module/posix/interp_posix.py 
b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -1319,12 +1319,12 @@
     result = os.makedev(major, minor)
     return space.wrap(result)
 
-@unwrap_spec(device=c_int)
+@unwrap_spec(device="c_uint")
 def major(space, device):
     result = os.major(device)
     return space.wrap(result)
 
-@unwrap_spec(device=c_int)
+@unwrap_spec(device="c_uint")
 def minor(space, device):
     result = os.minor(device)
     return space.wrap(result)
diff --git a/pypy/module/posix/test/test_posix2.py 
b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -766,6 +766,7 @@
             assert os.minor(12345) == self.expected_minor_12345
             assert os.makedev(self.expected_major_12345,
                               self.expected_minor_12345) == 12345
+            raises((ValueError, OverflowError), os.major, -1)
 
     if hasattr(os, 'fsync'):
         def test_fsync(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to