Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c1b65d18
Kaydet (Commit)
c1b65d18
authored
Kas 07, 2011
tarafından
Brian Curtin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix 13327. Remove explicit None arguments from futimes, futimens, futimesat,
and lutimes.
üst
b0d5b5d3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
28 deletions
+27
-28
os.rst
Doc/library/os.rst
+6
-10
test_posix.py
Lib/test/test_posix.py
+4
-0
posixmodule.c
Modules/posixmodule.c
+17
-18
No files found.
Doc/library/os.rst
Dosyayı görüntüle @
c1b65d18
...
...
@@ -872,8 +872,7 @@ as internal buffering of data.
.. versionadded:: 3.3
.. function:: futimesat(dirfd, path, (atime, mtime))
futimesat(dirfd, path, None)
.. function:: futimesat(dirfd, path[, (atime, mtime)])
Like :func:`utime` but if *path* is relative, it is taken as relative to *dirfd*.
If *path* is relative and *dirfd* is the special value :data:`AT_FDCWD`, then *path*
...
...
@@ -884,12 +883,11 @@ as internal buffering of data.
.. versionadded:: 3.3
.. function:: futimens(fd, (atime_sec, atime_nsec), (mtime_sec, mtime_nsec))
futimens(fd, None, None)
.. function:: futimens(fd[, (atime_sec, atime_nsec), (mtime_sec, mtime_nsec)])
Updates the timestamps of a file specified by the file descriptor *fd*, with
nanosecond precision.
The second form sets
*atime* and *mtime* to the current time.
If no second argument is given, set
*atime* and *mtime* to the current time.
If *atime_nsec* or *mtime_nsec* is specified as :data:`UTIME_NOW`, the corresponding
timestamp is updated to the current time.
If *atime_nsec* or *mtime_nsec* is specified as :data:`UTIME_OMIT`, the corresponding
...
...
@@ -911,11 +909,10 @@ as internal buffering of data.
.. versionadded:: 3.3
.. function:: futimes(fd, (atime, mtime))
futimes(fd, None)
.. function:: futimes(fd[, (atime, mtime)])
Set the access and modified time of the file specified by the file
descriptor *fd* to the given values. If
the second form
is used, set the
descriptor *fd* to the given values. If
no second argument
is used, set the
access and modified times to the current time.
Availability: Unix.
...
...
@@ -1702,8 +1699,7 @@ Files and Directories
Added support for Windows 6.0 (Vista) symbolic links.
.. function:: lutimes(path, (atime, mtime))
lutimes(path, None)
.. function:: lutimes(path[, (atime, mtime)])
Like :func:`utime`, but if *path* is a symbolic link, it is not
dereferenced.
...
...
Lib/test/test_posix.py
Dosyayı görüntüle @
c1b65d18
...
...
@@ -235,6 +235,7 @@ class PosixTester(unittest.TestCase):
fd
=
os
.
open
(
support
.
TESTFN
,
os
.
O_RDONLY
)
try
:
posix
.
futimes
(
fd
,
None
)
posix
.
futimes
(
fd
)
self
.
assertRaises
(
TypeError
,
posix
.
futimes
,
fd
,
(
None
,
None
))
self
.
assertRaises
(
TypeError
,
posix
.
futimes
,
fd
,
(
now
,
None
))
self
.
assertRaises
(
TypeError
,
posix
.
futimes
,
fd
,
(
None
,
now
))
...
...
@@ -252,6 +253,7 @@ class PosixTester(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
posix
.
lutimes
,
support
.
TESTFN
,
(
None
,
now
))
posix
.
lutimes
(
support
.
TESTFN
,
(
int
(
now
),
int
(
now
)))
posix
.
lutimes
(
support
.
TESTFN
,
(
now
,
now
))
posix
.
lutimes
(
support
.
TESTFN
)
@unittest.skipUnless
(
hasattr
(
posix
,
'futimens'
),
"test needs posix.futimens()"
)
def
test_futimens
(
self
):
...
...
@@ -263,6 +265,7 @@ class PosixTester(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
posix
.
futimens
,
fd
,
None
,
(
now
,
0
))
posix
.
futimens
(
fd
,
(
int
(
now
),
int
((
now
-
int
(
now
))
*
1e9
)),
(
int
(
now
),
int
((
now
-
int
(
now
))
*
1e9
)))
posix
.
futimens
(
fd
)
finally
:
os
.
close
(
fd
)
...
...
@@ -691,6 +694,7 @@ class PosixTester(unittest.TestCase):
try
:
now
=
time
.
time
()
posix
.
futimesat
(
f
,
support
.
TESTFN
,
None
)
posix
.
futimesat
(
f
,
support
.
TESTFN
)
self
.
assertRaises
(
TypeError
,
posix
.
futimesat
,
f
,
support
.
TESTFN
,
(
None
,
None
))
self
.
assertRaises
(
TypeError
,
posix
.
futimesat
,
f
,
support
.
TESTFN
,
(
now
,
None
))
self
.
assertRaises
(
TypeError
,
posix
.
futimesat
,
f
,
support
.
TESTFN
,
(
None
,
now
))
...
...
Modules/posixmodule.c
Dosyayı görüntüle @
c1b65d18
...
...
@@ -3534,10 +3534,10 @@ extract_time(PyObject *t, time_t* sec, long* usec)
}
PyDoc_STRVAR
(
posix_utime__doc__
,
"utime(path
, (atime, mtime)
)
\n
\
utime(path, None)
\n
\n
\
Set the access and modified time of the file to the given values. If the
\n
\
second form is used, set the access and modified times to
the current time."
);
"utime(path
[, (atime, mtime)]
)
\n
\
Set the access and modified time of the file to the given values.
\n
\
If no second argument is used, set the access and modified times to
\n
\
the current time."
);
static
PyObject
*
posix_utime
(
PyObject
*
self
,
PyObject
*
args
)
...
...
@@ -3706,21 +3706,20 @@ done:
#ifdef HAVE_FUTIMES
PyDoc_STRVAR
(
posix_futimes__doc__
,
"futimes(fd, (atime, mtime))
\n
\
futimes(fd, None)
\n\n
\
"futimes(fd[, (atime, mtime)])
\n
\
Set the access and modified time of the file specified by the file
\n
\
descriptor fd to the given values. If
the second form
is used, set the
\n
\
descriptor fd to the given values. If
no second argument
is used, set the
\n
\
access and modified times to the current time."
);
static
PyObject
*
posix_futimes
(
PyObject
*
self
,
PyObject
*
args
)
{
int
res
,
fd
;
PyObject
*
arg
;
PyObject
*
arg
=
Py_None
;
time_t
atime
,
mtime
;
long
ausec
,
musec
;
if
(
!
PyArg_ParseTuple
(
args
,
"iO:futimes"
,
&
fd
,
&
arg
))
if
(
!
PyArg_ParseTuple
(
args
,
"i
|
O:futimes"
,
&
fd
,
&
arg
))
return
NULL
;
if
(
arg
==
Py_None
)
{
...
...
@@ -3771,20 +3770,20 @@ posix_futimes(PyObject *self, PyObject *args)
#ifdef HAVE_LUTIMES
PyDoc_STRVAR
(
posix_lutimes__doc__
,
"lutimes(path, (atime, mtime))
\n
\
lutimes(path, None)
\n\n
\
"lutimes(path[, (atime, mtime)])
\n
\
Like utime(), but if path is a symbolic link, it is not dereferenced."
);
static
PyObject
*
posix_lutimes
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
opath
,
*
arg
;
PyObject
*
opath
;
PyObject
*
arg
=
Py_None
;
const
char
*
path
;
int
res
;
time_t
atime
,
mtime
;
long
ausec
,
musec
;
if
(
!
PyArg_ParseTuple
(
args
,
"O&O:lutimes"
,
if
(
!
PyArg_ParseTuple
(
args
,
"O&
|
O:lutimes"
,
PyUnicode_FSConverter
,
&
opath
,
&
arg
))
return
NULL
;
path
=
PyBytes_AsString
(
opath
);
...
...
@@ -3840,11 +3839,10 @@ posix_lutimes(PyObject *self, PyObject *args)
#ifdef HAVE_FUTIMENS
PyDoc_STRVAR
(
posix_futimens__doc__
,
"futimens(fd, (atime_sec, atime_nsec), (mtime_sec, mtime_nsec))
\n
\
futimens(fd, None, None)
\n\n
\
"futimens(fd[, (atime_sec, atime_nsec), (mtime_sec, mtime_nsec)])
\n
\
Updates the timestamps of a file specified by the file descriptor fd, with
\n
\
nanosecond precision.
\n
\
The second form sets
atime and mtime to the current time.
\n
\
If no second argument is given, set
atime and mtime to the current time.
\n
\
If *_nsec is specified as UTIME_NOW, the timestamp is updated to the
\n
\
current time.
\n
\
If *_nsec is specified as UTIME_OMIT, the timestamp is not updated."
);
...
...
@@ -3853,10 +3851,11 @@ static PyObject *
posix_futimens
(
PyObject
*
self
,
PyObject
*
args
)
{
int
res
,
fd
;
PyObject
*
atime
,
*
mtime
;
PyObject
*
atime
=
Py_None
;
PyObject
*
mtime
=
Py_None
;
struct
timespec
buf
[
2
];
if
(
!
PyArg_ParseTuple
(
args
,
"iOO:futimens"
,
if
(
!
PyArg_ParseTuple
(
args
,
"i
|
OO:futimens"
,
&
fd
,
&
atime
,
&
mtime
))
return
NULL
;
if
(
atime
==
Py_None
&&
mtime
==
Py_None
)
{
...
...
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