There was an error while loading. Please reload this page.
1 parent 91a7af3 commit 2cf3917Copy full SHA for 2cf3917
2 files changed
Lib/pathlib.py
@@ -6,7 +6,6 @@
6
import posixpath
7
import re
8
import sys
9
-import time
10
import weakref
11
try:
12
import threading
@@ -1076,9 +1075,8 @@ def touch(self, mode=0o666, exist_ok=True):
1076
1075
# First try to bump modification time
1077
# Implementation note: GNU touch uses the UTIME_NOW option of
1078
# the utimensat() / futimens() functions.
1079
- t = time.time()
1080
1081
- self._accessor.utime(self, (t, t))
+ self._accessor.utime(self, None)
1082
except OSError:
1083
# Avoid exception chaining
1084
pass
Lib/test/test_pathlib.py
@@ -1391,11 +1391,8 @@ def test_touch_common(self):
1391
# The file mtime should be refreshed by calling touch() again
1392
p.touch()
1393
st = p.stat()
1394
- # Issue #19715: there can be an inconsistency under Windows between
1395
- # the timestamp rounding when creating a file, and the timestamp
1396
- # rounding done when calling utime(). `delta` makes up for this.
1397
- delta = 1e-6 if os.name == 'nt' else 0
1398
- self.assertGreaterEqual(st.st_mtime, old_mtime - delta)
+ self.assertGreaterEqual(st.st_mtime_ns, old_mtime_ns)
+ self.assertGreaterEqual(st.st_mtime, old_mtime)
1399
# Now with exist_ok=False
1400
p = P / 'newfileB'
1401
self.assertFalse(p.exists())
0 commit comments