diff options
author | Larry Hastings <larry@hastings.org> | 2013-08-08 00:19:50 -0700 |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2013-08-08 00:19:50 -0700 |
commit | 9382406a268494004ded81655f14c4fafb2a0a51 (patch) | |
tree | 89d76ab4ef8044baa8dd04128ec53b0295871f1a /Lib/test/test_os.py | |
parent | 7646ecb0ecf5718b267942b0fca8f27280d154c1 (diff) | |
download | cpython-9382406a268494004ded81655f14c4fafb2a0a51.tar.gz |
Issue #15301: Parsing fd, uid, and gid parameters for builtins
in Modules/posixmodule.c is now far more robust.
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r-- | Lib/test/test_os.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 8916305f1c..13ff18f347 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 |