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
18aaa568
Commit
18aaa568
authored
Oct 15, 2006
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #1576166: Support os.utime for directories on Windows NT+.
parent
c9e82f62
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
Lib/test/test_os.py
Lib/test/test_os.py
+7
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/posixmodule.c
Modules/posixmodule.c
+5
-2
No files found.
Lib/test/test_os.py
View file @
18aaa568
...
...
@@ -223,6 +223,13 @@ class StatAttributeTests(unittest.TestCase):
except
TypeError
:
pass
def
test_utime_dir
(
self
):
delta
=
1000000
st
=
os
.
stat
(
test_support
.
TESTFN
)
os
.
utime
(
test_support
.
TESTFN
,
(
st
.
st_atime
,
st
.
st_mtime
-
delta
))
st2
=
os
.
stat
(
test_support
.
TESTFN
)
self
.
assertEquals
(
st2
.
st_mtime
,
st
.
st_mtime
-
delta
)
# Restrict test to Win32, since there is no guarantee other
# systems support centiseconds
if
sys
.
platform
==
'win32'
:
...
...
Misc/NEWS
View file @
18aaa568
...
...
@@ -137,6 +137,8 @@ Library
Extension
Modules
-----------------
-
Patch
#
1576166
:
Support
os
.
utime
for
directories
on
Windows
NT
+.
-
Bug
#
1548891
:
The
cStringIO
.
StringIO
()
constructor
now
encodes
unicode
arguments
with
the
system
default
encoding
just
like
the
write
()
method
does
,
instead
of
converting
it
to
a
raw
buffer
.
...
...
Modules/posixmodule.c
View file @
18aaa568
...
...
@@ -2458,7 +2458,8 @@ posix_utime(PyObject *self, PyObject *args)
wpath
=
PyUnicode_AS_UNICODE
(
obwpath
);
Py_BEGIN_ALLOW_THREADS
hFile
=
CreateFileW
(
wpath
,
FILE_WRITE_ATTRIBUTES
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
NULL
);
Py_END_ALLOW_THREADS
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
win32_error_unicode
(
"utime"
,
wpath
);
...
...
@@ -2473,7 +2474,8 @@ posix_utime(PyObject *self, PyObject *args)
return
NULL
;
Py_BEGIN_ALLOW_THREADS
hFile
=
CreateFileA
(
apath
,
FILE_WRITE_ATTRIBUTES
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
NULL
);
Py_END_ALLOW_THREADS
if
(
hFile
==
INVALID_HANDLE_VALUE
)
{
win32_error
(
"utime"
,
apath
);
...
...
@@ -8617,3 +8619,4 @@ INITFUNC(void)
}
#endif
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