summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2013-08-08 07:19:50 (GMT)
committerLarry Hastings <larry@hastings.org>2013-08-08 07:19:50 (GMT)
commita27b83ad2d3480ba7c20286d719025ef32100f75 (patch)
tree6e6849505b4c796e8a50bbbdeb9744d76a64f33e /Lib/test
parent7533137f4e1c78fda6041175f220bf1f77ee95a5 (diff)
downloadcpython-a27b83ad2d3480ba7c20286d719025ef32100f75.zip
cpython-a27b83ad2d3480ba7c20286d719025ef32100f75.tar.gz
cpython-a27b83ad2d3480ba7c20286d719025ef32100f75.tar.bz2
Issue #15301: Parsing fd, uid, and gid parameters for builtins
in Modules/posixmodule.c is now far more robust.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_os.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 8916305..13ff18f 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -24,6 +24,8 @@ import itertools
import stat
import locale
import codecs
+import decimal
+import fractions
try:
import threading
except ImportError:
@@ -865,6 +867,16 @@ class MakedirTests(unittest.TestCase):
os.makedirs(path, mode=mode, exist_ok=True)
os.umask(old_mask)
+ def test_chown_uid_gid_arguments_must_be_index(self):
+ stat = os.stat(support.TESTFN)
+ uid = stat.st_uid
+ gid = stat.st_gid
+ for value in (-1.0, -1j, decimal.Decimal(-1), fractions.Fraction(-2, 2)):
+ self.assertRaises(TypeError, os.chown, support.TESTFN, value, gid)
+ self.assertRaises(TypeError, os.chown, support.TESTFN, uid, value)
+ self.assertIsNone(os.chown(support.TESTFN, uid, gid))
+ self.assertIsNone(os.chown(support.TESTFN, -1, -1))
+
def test_exist_ok_s_isgid_directory(self):
path = os.path.join(support.TESTFN, 'dir1')
S_ISGID = stat.S_ISGID