Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c3055be5
Commit
c3055be5
authored
Nov 23, 2013
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trying other strategy for #19715: use utime(..., None)
parent
f8d0ff9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
8 deletions
+3
-8
Lib/pathlib.py
Lib/pathlib.py
+1
-3
Lib/test/test_pathlib.py
Lib/test/test_pathlib.py
+2
-5
No files found.
Lib/pathlib.py
View file @
c3055be5
...
...
@@ -6,7 +6,6 @@ import os
import
posixpath
import
re
import
sys
import
time
import
weakref
try
:
import
threading
...
...
@@ -1076,9 +1075,8 @@ class Path(PurePath):
# First try to bump modification time
# Implementation note: GNU touch uses the UTIME_NOW option of
# the utimensat() / futimens() functions.
t
=
time
.
time
()
try
:
self
.
_accessor
.
utime
(
self
,
(
t
,
t
)
)
self
.
_accessor
.
utime
(
self
,
None
)
except
OSError
:
# Avoid exception chaining
pass
...
...
Lib/test/test_pathlib.py
View file @
c3055be5
...
...
@@ -1391,11 +1391,8 @@ class _BasePathTest(object):
# The file mtime should be refreshed by calling touch() again
p
.
touch
()
st
=
p
.
stat
()
# Issue #19715: there can be an inconsistency under Windows between
# the timestamp rounding when creating a file, and the timestamp
# rounding done when calling utime(). `delta` makes up for this.
delta
=
1e-6
if
os
.
name
==
'nt'
else
0
self
.
assertGreaterEqual
(
st
.
st_mtime
,
old_mtime
-
delta
)
self
.
assertGreaterEqual
(
st
.
st_mtime_ns
,
old_mtime_ns
)
self
.
assertGreaterEqual
(
st
.
st_mtime
,
old_mtime
)
# Now with exist_ok=False
p
=
P
/
'newfileB'
self
.
assertFalse
(
p
.
exists
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment