mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Fix #13327. utimensat now has the atime and mtime arguments set as optional,
defaulting to None like the other utimes family members. It now accepts keyword arguments because, unlike other other functions in the family, it has a `flags` value at the end of the argument list (which retains its 0 default).
This commit is contained in:
parent
7ef53ef916
commit
569b494320
3 changed files with 21 additions and 11 deletions
|
@ -815,11 +815,16 @@ class PosixTester(unittest.TestCase):
|
|||
try:
|
||||
now = time.time()
|
||||
posix.utimensat(f, support.TESTFN, None, None)
|
||||
posix.utimensat(f, support.TESTFN)
|
||||
posix.utimensat(f, support.TESTFN, flags=os.AT_SYMLINK_NOFOLLOW)
|
||||
self.assertRaises(TypeError, posix.utimensat, f, support.TESTFN, (None, None), (None, None))
|
||||
self.assertRaises(TypeError, posix.utimensat, f, support.TESTFN, (now, 0), None)
|
||||
self.assertRaises(TypeError, posix.utimensat, f, support.TESTFN, None, (now, 0))
|
||||
posix.utimensat(f, support.TESTFN, (int(now), int((now - int(now)) * 1e9)),
|
||||
(int(now), int((now - int(now)) * 1e9)))
|
||||
posix.utimensat(dirfd=f, path=support.TESTFN,
|
||||
atime=(int(now), int((now - int(now)) * 1e9)),
|
||||
mtime=(int(now), int((now - int(now)) * 1e9)))
|
||||
finally:
|
||||
posix.close(f)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue