mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #15301: Parsing fd, uid, and gid parameters for builtins
in Modules/posixmodule.c is now far more robust.
This commit is contained in:
parent
7533137f4e
commit
a27b83ad2d
3 changed files with 205 additions and 81 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue