mirror of
https://github.com/python/cpython.git
synced 2025-07-16 07:45:20 +00:00
bpo-35371: Fix possible crash in os.utime() on Windows. (GH-10844)
This commit is contained in:
parent
edeca92c84
commit
32bc11c33c
3 changed files with 40 additions and 22 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue