vstinner / rpms / python3

Forked from rpms/python3 5 years ago
Clone
1c94c1a
diff -up Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_os.py
1c94c1a
--- Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows	2012-06-26 16:19:48.000000000 -0400
1c94c1a
+++ Python-3.3.0b1/Lib/test/test_os.py	2012-07-20 14:21:46.856688739 -0400
1c94c1a
@@ -1174,30 +1174,36 @@ if sys.platform != 'win32':
7989368
             def test_setuid(self):
7989368
                 if os.getuid() != 0:
7989368
                     self.assertRaises(os.error, os.setuid, 0)
7989368
+                self.assertRaises(TypeError, os.setuid, 'not an int')
7989368
                 self.assertRaises(OverflowError, os.setuid, 1<<32)
7989368
 
7989368
         if hasattr(os, 'setgid'):
7989368
             def test_setgid(self):
58f477b
                 if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
7989368
                     self.assertRaises(os.error, os.setgid, 0)
7989368
+                self.assertRaises(TypeError, os.setgid, 'not an int')
7989368
                 self.assertRaises(OverflowError, os.setgid, 1<<32)
7989368
 
7989368
         if hasattr(os, 'seteuid'):
7989368
             def test_seteuid(self):
7989368
                 if os.getuid() != 0:
7989368
                     self.assertRaises(os.error, os.seteuid, 0)
7989368
+                self.assertRaises(TypeError, os.seteuid, 'not an int')
7989368
                 self.assertRaises(OverflowError, os.seteuid, 1<<32)
7989368
 
7989368
         if hasattr(os, 'setegid'):
7989368
             def test_setegid(self):
58f477b
                 if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
7989368
                     self.assertRaises(os.error, os.setegid, 0)
7989368
+                self.assertRaises(TypeError, os.setegid, 'not an int')
7989368
                 self.assertRaises(OverflowError, os.setegid, 1<<32)
7989368
 
7989368
         if hasattr(os, 'setreuid'):
7989368
             def test_setreuid(self):
7989368
                 if os.getuid() != 0:
7989368
                     self.assertRaises(os.error, os.setreuid, 0, 0)
7989368
+                self.assertRaises(TypeError, os.setreuid, 'not an int', 0)
7989368
+                self.assertRaises(TypeError, os.setreuid, 0, 'not an int')
7989368
                 self.assertRaises(OverflowError, os.setreuid, 1<<32, 0)
7989368
                 self.assertRaises(OverflowError, os.setreuid, 0, 1<<32)
7989368
 
1c94c1a
@@ -1212,6 +1218,8 @@ if sys.platform != 'win32':
7989368
             def test_setregid(self):
58f477b
                 if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
7989368
                     self.assertRaises(os.error, os.setregid, 0, 0)
7989368
+                self.assertRaises(TypeError, os.setregid, 'not an int', 0)
7989368
+                self.assertRaises(TypeError, os.setregid, 0, 'not an int')
7989368
                 self.assertRaises(OverflowError, os.setregid, 1<<32, 0)
7989368
                 self.assertRaises(OverflowError, os.setregid, 0, 1<<32)
7989368
 
1c94c1a
diff -up Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_pwd.py
1c94c1a
--- Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows	2012-06-26 16:19:48.000000000 -0400
1c94c1a
+++ Python-3.3.0b1/Lib/test/test_pwd.py	2012-07-20 14:21:46.857688726 -0400
7989368
@@ -87,9 +87,9 @@ class PwdTest(unittest.TestCase):
7989368
         # In some cases, byuids isn't a complete list of all users in the
7989368
         # system, so if we try to pick a value not in byuids (via a perturbing
7989368
         # loop, say), pwd.getpwuid() might still be able to find data for that
7989368
-        # uid. Using sys.maxint may provoke the same problems, but hopefully
7989368
+        # uid. Using 2**32 - 2 may provoke the same problems, but hopefully
7989368
         # it will be a more repeatable failure.
7989368
-        fakeuid = sys.maxsize
7989368
+        fakeuid = 2**32 - 2
7989368
         self.assertNotIn(fakeuid, byuids)
7989368
         self.assertRaises(KeyError, pwd.getpwuid, fakeuid)
7989368