diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-01 12:30:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-01 12:30:20 (GMT) |
commit | 32bc11c33cf5ccea165b5f4ac3799f02fdf9c76a (patch) | |
tree | fdc11cee67562143618adfe6bff187b5d7393f8d /Lib | |
parent | edeca92c84a3b08902ecdfe987cde00c7e617887 (diff) | |
download | cpython-32bc11c33cf5ccea165b5f4ac3799f02fdf9c76a.zip cpython-32bc11c33cf5ccea165b5f4ac3799f02fdf9c76a.tar.gz cpython-32bc11c33cf5ccea165b5f4ac3799f02fdf9c76a.tar.bz2 |
bpo-35371: Fix possible crash in os.utime() on Windows. (GH-10844)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_os.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 3f6e48f..aca445f 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -634,6 +634,29 @@ class UtimeTests(unittest.TestCase): # seconds and nanoseconds parameters are mutually exclusive with self.assertRaises(ValueError): os.utime(self.fname, (5, 5), ns=(5, 5)) + with self.assertRaises(TypeError): + os.utime(self.fname, [5, 5]) + with self.assertRaises(TypeError): + os.utime(self.fname, (5,)) + with self.assertRaises(TypeError): + os.utime(self.fname, (5, 5, 5)) + with self.assertRaises(TypeError): + os.utime(self.fname, ns=[5, 5]) + with self.assertRaises(TypeError): + os.utime(self.fname, ns=(5,)) + with self.assertRaises(TypeError): + os.utime(self.fname, ns=(5, 5, 5)) + + if os.utime not in os.supports_follow_symlinks: + with self.assertRaises(NotImplementedError): + os.utime(self.fname, (5, 5), follow_symlinks=False) + if os.utime not in os.supports_fd: + with open(self.fname, 'wb', 0) as fp: + with self.assertRaises(TypeError): + os.utime(fp.fileno(), (5, 5)) + if os.utime not in os.supports_dir_fd: + with self.assertRaises(NotImplementedError): + os.utime(self.fname, (5, 5), dir_fd=0) @support.cpython_only def test_issue31577(self): |