mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue #11016: Add C implementation of the stat module as _stat
This commit is contained in:
parent
6ce8d17d02
commit
c77d9f38c2
9 changed files with 679 additions and 23 deletions
|
|
@ -6,7 +6,8 @@
|
|||
os.lstat() and os.fstat().
|
||||
.. sectionauthor:: Skip Montanaro <skip@automatrix.com>
|
||||
|
||||
**Source code:** :source:`Lib/stat.py`
|
||||
**Source code:** :source:`Modules/_stat.c`
|
||||
:source:`Lib/stat.py`
|
||||
|
||||
--------------
|
||||
|
||||
|
|
@ -15,6 +16,9 @@ results of :func:`os.stat`, :func:`os.fstat` and :func:`os.lstat` (if they
|
|||
exist). For complete details about the :c:func:`stat`, :c:func:`fstat` and
|
||||
:c:func:`lstat` calls, consult the documentation for your system.
|
||||
|
||||
.. versionchanged:: 3.4
|
||||
The stat module is backed by a C implementation.
|
||||
|
||||
The :mod:`stat` module defines the following functions to test for specific file
|
||||
types:
|
||||
|
||||
|
|
@ -53,6 +57,24 @@ types:
|
|||
|
||||
Return non-zero if the mode is from a socket.
|
||||
|
||||
.. function:: S_ISDOOR(mode)
|
||||
|
||||
Return non-zero if the mode is from a door.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
.. function:: S_ISPORT(mode)
|
||||
|
||||
Return non-zero if the mode is from an event port.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
.. function:: S_ISWHT(mode)
|
||||
|
||||
Return non-zero if the mode is from a whiteout.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
Two additional functions are defined for more general manipulation of the file's
|
||||
mode:
|
||||
|
||||
|
|
@ -113,6 +135,10 @@ readable string:
|
|||
|
||||
.. versionadded:: 3.3
|
||||
|
||||
.. versionchanged:: 3.4
|
||||
The function supports :data:`S_IFDOOR`, :data:`S_IFPORT` and
|
||||
:data:`S_IFWHT`.
|
||||
|
||||
|
||||
All the variables below are simply symbolic indexes into the 10-tuple returned
|
||||
by :func:`os.stat`, :func:`os.fstat` or :func:`os.lstat`.
|
||||
|
|
@ -210,6 +236,29 @@ Use of the functions above is more portable than use of the first set of flags:
|
|||
|
||||
FIFO.
|
||||
|
||||
.. data:: S_IFDOOR
|
||||
|
||||
Door.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
.. data:: S_IFPORT
|
||||
|
||||
Event port.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
.. data:: S_IFWHT
|
||||
|
||||
Whiteout.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
.. note::
|
||||
|
||||
:data:`S_IFDOOR`, :data:`S_IFPORT` or :data:`S_IFWHT` are defined as
|
||||
0 when the platform does not have support for the file types.
|
||||
|
||||
The following flags can also be used in the *mode* argument of :func:`os.chmod`:
|
||||
|
||||
.. data:: S_ISUID
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue