Skip to content

Commit 4762cdd

Browse files
Merge branch 'main' into gh-151627-odict-iterator-race
2 parents ba229fd + a9db5cb commit 4762cdd

32 files changed

Lines changed: 3014 additions & 135 deletions

Doc/library/curses.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,17 @@ The module :mod:`!curses` defines the following functions:
204204
character-at-a-time line editing without touching the rest of the screen.
205205

206206

207+
.. function:: nofilter()
208+
209+
Undo the effect of a previous :func:`.filter` call.
210+
Like :func:`.filter`, it must be called before :func:`initscr` so that the
211+
next initialization uses the full screen again.
212+
213+
Availability: if the underlying curses library provides ``nofilter()``.
214+
215+
.. versionadded:: next
216+
217+
207218
.. function:: flash()
208219

209220
Flash the screen. That is, change it to reverse-video and then change it back

Doc/library/os.rst

Lines changed: 210 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ process and user.
541541
Return a tuple (ruid, euid, suid) denoting the current process's
542542
real, effective, and saved user ids.
543543

544-
.. availability:: Unix, not WASI.
544+
.. availability:: Unix, not WASI, not macOS, not iOS.
545545

546546
.. versionadded:: 3.2
547547

@@ -551,7 +551,7 @@ process and user.
551551
Return a tuple (rgid, egid, sgid) denoting the current process's
552552
real, effective, and saved group ids.
553553

554-
.. availability:: Unix, not WASI.
554+
.. availability:: Unix, not WASI, not macOS, not iOS.
555555

556556
.. versionadded:: 3.2
557557

@@ -725,7 +725,7 @@ process and user.
725725

726726
Set the current process's real, effective, and saved group ids.
727727

728-
.. availability:: Unix, not WASI, not Android.
728+
.. availability:: Unix, not WASI, not Android, not macOS, not iOS.
729729

730730
.. versionadded:: 3.2
731731

@@ -734,7 +734,7 @@ process and user.
734734

735735
Set the current process's real, effective, and saved user ids.
736736

737-
.. availability:: Unix, not WASI, not Android.
737+
.. availability:: Unix, not WASI, not Android, not macOS, not iOS.
738738

739739
.. versionadded:: 3.2
740740

@@ -800,36 +800,61 @@ process and user.
800800
single: gethostbyaddr() (in module socket)
801801

802802
Returns information identifying the current operating system.
803-
The return value is an object with five attributes:
804-
805-
* :attr:`sysname` - operating system name
806-
* :attr:`nodename` - name of machine on network (implementation-defined)
807-
* :attr:`release` - operating system release
808-
* :attr:`version` - operating system version
809-
* :attr:`machine` - hardware identifier
810-
811-
For backwards compatibility, this object is also iterable, behaving
812-
like a five-tuple containing :attr:`sysname`, :attr:`nodename`,
813-
:attr:`release`, :attr:`version`, and :attr:`machine`
814-
in that order.
815-
816-
Some systems truncate :attr:`nodename` to 8 characters or to the
817-
leading component; a better way to get the hostname is
818-
:func:`socket.gethostname` or even
819-
``socket.gethostbyaddr(socket.gethostname())``.
803+
The return value is a :class:`uname_result`.
820804

821805
On macOS, iOS and Android, this returns the *kernel* name and version (i.e.,
822806
``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform.uname`
823807
can be used to get the user-facing operating system name and version on iOS and
824808
Android.
825809

810+
.. seealso::
811+
:data:`sys.platform` which has finer granularity.
812+
813+
The :mod:`platform` module provides detailed checks for the
814+
system's identity.
815+
826816
.. availability:: Unix.
827817

828818
.. versionchanged:: 3.3
829819
Return type changed from a tuple to a tuple-like object
830820
with named attributes.
831821

832822

823+
.. class:: uname_result
824+
825+
Name and information about the system returned by :func:`os.uname`.
826+
These attributes correspond to the members described in :manpage:`uname(2)`.
827+
828+
For backwards compatibility, this object is also iterable, behaving
829+
like a five-tuple containing :attr:`~uname_result.sysname`,
830+
:attr:`~uname_result.nodename`, :attr:`~uname_result.release`,
831+
:attr:`~uname_result.version`, and :attr:`~uname_result.machine`
832+
in that order.
833+
834+
.. attribute:: sysname
835+
836+
Operating system name.
837+
838+
.. attribute:: nodename
839+
840+
Name of machine on network. Some systems truncate
841+
:attr:`~uname_result.nodename` to 8 characters or to the leading
842+
component; a better way to get the hostname is :func:`socket.gethostname`
843+
or even ``socket.gethostbyaddr(socket.gethostname())``.
844+
845+
.. attribute:: release
846+
847+
Operating system release.
848+
849+
.. attribute:: version
850+
851+
Operating system version.
852+
853+
.. attribute:: machine
854+
855+
Hardware identifier.
856+
857+
833858
.. function:: unsetenv(key, /)
834859

835860
.. index:: single: environment variables; deleting
@@ -1071,10 +1096,7 @@ as internal buffering of data.
10711096
Force write of file with filedescriptor *fd* to disk. Does not force update of
10721097
metadata.
10731098

1074-
.. availability:: Unix.
1075-
1076-
.. note::
1077-
This function is not available on MacOS.
1099+
.. availability:: Unix, not macOS, not iOS.
10781100

10791101

10801102
.. function:: fpathconf(fd, name, /)
@@ -1112,8 +1134,8 @@ as internal buffering of data.
11121134
.. function:: fstatvfs(fd, /)
11131135

11141136
Return information about the filesystem containing the file associated with
1115-
file descriptor *fd*, like :func:`statvfs`. As of Python 3.3, this is
1116-
equivalent to ``os.statvfs(fd)``.
1137+
file descriptor *fd* in a :class:`statvfs_result`, like :func:`statvfs`.
1138+
As of Python 3.3, this is equivalent to ``os.statvfs(fd)``.
11171139

11181140
.. availability:: Unix.
11191141

@@ -1426,7 +1448,7 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
14261448
Return a pair of file descriptors ``(r, w)`` usable for reading and writing,
14271449
respectively.
14281450

1429-
.. availability:: Unix, not WASI.
1451+
.. availability:: Unix, not WASI, not macOS, not iOS.
14301452

14311453
.. versionadded:: 3.3
14321454

@@ -1436,7 +1458,7 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
14361458
Ensures that enough disk space is allocated for the file specified by *fd*
14371459
starting from *offset* and continuing for *len* bytes.
14381460

1439-
.. availability:: Unix.
1461+
.. availability:: Unix, not macOS, not iOS.
14401462

14411463
.. versionadded:: 3.3
14421464

@@ -1451,7 +1473,7 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
14511473
:data:`POSIX_FADV_RANDOM`, :data:`POSIX_FADV_NOREUSE`,
14521474
:data:`POSIX_FADV_WILLNEED` or :data:`POSIX_FADV_DONTNEED`.
14531475

1454-
.. availability:: Unix.
1476+
.. availability:: Unix, not macOS, not iOS.
14551477

14561478
.. versionadded:: 3.3
14571479

@@ -3784,48 +3806,174 @@ features:
37843806

37853807
.. function:: statvfs(path)
37863808

3787-
Perform a :c:func:`!statvfs` system call on the given path. The return value is
3788-
an object whose attributes describe the filesystem on the given path, and
3789-
correspond to the members of the :c:struct:`statvfs` structure, namely:
3790-
:attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:`f_bfree`,
3791-
:attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:`f_favail`,
3792-
:attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`.
3793-
3794-
Two module-level constants are defined for the :attr:`f_flag` attribute's
3795-
bit-flags: if :const:`ST_RDONLY` is set, the filesystem is mounted
3796-
read-only, and if :const:`ST_NOSUID` is set, the semantics of
3797-
setuid/setgid bits are disabled or not supported.
3798-
3799-
Additional module-level constants are defined for GNU/glibc based systems.
3800-
These are :const:`ST_NODEV` (disallow access to device special files),
3801-
:const:`ST_NOEXEC` (disallow program execution), :const:`ST_SYNCHRONOUS`
3802-
(writes are synced at once), :const:`ST_MANDLOCK` (allow mandatory locks on an FS),
3803-
:const:`ST_WRITE` (write on file/directory/symlink), :const:`ST_APPEND`
3804-
(append-only file), :const:`ST_IMMUTABLE` (immutable file), :const:`ST_NOATIME`
3805-
(do not update access times), :const:`ST_NODIRATIME` (do not update directory access
3806-
times), :const:`ST_RELATIME` (update atime relative to mtime/ctime).
3809+
Perform a :manpage:`statvfs(3)` system call on the given path. The return value
3810+
is a :class:`statvfs_result` whose attributes describe the filesystem
3811+
on the given path and correspond to the members of the :c:struct:`statvfs`
3812+
structure.
38073813

38083814
This function can support :ref:`specifying a file descriptor <path_fd>`.
38093815

38103816
.. availability:: Unix.
38113817

3812-
.. versionchanged:: 3.2
3813-
The :const:`ST_RDONLY` and :const:`ST_NOSUID` constants were added.
3814-
38153818
.. versionchanged:: 3.3
38163819
Added support for specifying *path* as an open file descriptor.
38173820

3818-
.. versionchanged:: 3.4
3819-
The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`,
3820-
:const:`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`,
3821-
:const:`ST_IMMUTABLE`, :const:`ST_NOATIME`, :const:`ST_NODIRATIME`,
3822-
and :const:`ST_RELATIME` constants were added.
3823-
38243821
.. versionchanged:: 3.6
38253822
Accepts a :term:`path-like object`.
38263823

3827-
.. versionchanged:: 3.7
3828-
Added the :attr:`f_fsid` attribute.
3824+
3825+
.. class:: statvfs_result
3826+
3827+
Filesystem statistics returned by :func:`os.statvfs` and :func:`os.fstatvfs`.
3828+
See :manpage:`statvfs(3)` for more details.
3829+
3830+
.. attribute:: f_bsize
3831+
3832+
Block size.
3833+
3834+
.. attribute:: f_frsize
3835+
3836+
Fragment size.
3837+
3838+
.. attribute:: f_blocks
3839+
3840+
Number of :attr:`~statvfs_result.f_frsize` sized blocks the filesystem
3841+
can contain.
3842+
3843+
.. attribute:: f_bfree
3844+
3845+
Number of free blocks.
3846+
3847+
.. attribute:: f_bavail
3848+
3849+
Number of free blocks for unprivileged users.
3850+
3851+
.. attribute:: f_files
3852+
3853+
Number of file entries, inodes, the filesystem can contain.
3854+
3855+
.. attribute:: f_ffree
3856+
3857+
Number of free files entries.
3858+
3859+
.. attribute:: f_favail
3860+
3861+
Number of free file entries for unprivileged users.
3862+
3863+
.. attribute:: f_flag
3864+
3865+
Bit-mask of mount flags. The following flags are defined:
3866+
:data:`ST_RDONLY`, :data:`ST_NOSUID`, :data:`ST_NODEV`,
3867+
:data:`ST_NOEXEC`, :data:`ST_SYNCHRONOUS`, :data:`ST_MANDLOCK`,
3868+
:data:`ST_WRITE`, :data:`ST_APPEND`, :data:`ST_IMMUTABLE`,
3869+
:data:`ST_NOATIME`, :data:`ST_NODIRATIME`, and :data:`ST_RELATIME`.
3870+
3871+
.. attribute:: f_namemax
3872+
3873+
Filesystem max filename length. OS specific limitations such as
3874+
:ref:`Windows MAX_PATH <max-path>` and those described in Linux
3875+
:manpage:`pathname(7)` may exist.
3876+
3877+
.. attribute:: f_fsid
3878+
3879+
Filesystem ID.
3880+
3881+
.. versionadded:: 3.7
3882+
3883+
3884+
The following flags are used in :attr:`statvfs_result.f_flag`.
3885+
3886+
.. data:: ST_RDONLY
3887+
3888+
Read-only filesystem.
3889+
3890+
.. versionadded:: 3.2
3891+
3892+
.. data:: ST_NOSUID
3893+
3894+
Setuid/setgid bits are disabled or not supported.
3895+
3896+
.. versionadded:: 3.2
3897+
3898+
.. data:: ST_NODEV
3899+
3900+
Disallow access to device special files.
3901+
3902+
.. availability:: Linux.
3903+
3904+
.. versionadded:: 3.4
3905+
3906+
.. data:: ST_NOEXEC
3907+
3908+
Disallow program execution.
3909+
3910+
.. availability:: Linux.
3911+
3912+
.. versionadded:: 3.4
3913+
3914+
.. data:: ST_SYNCHRONOUS
3915+
3916+
Writes are synced at once.
3917+
3918+
.. availability:: Linux.
3919+
3920+
.. versionadded:: 3.4
3921+
3922+
.. data:: ST_MANDLOCK
3923+
3924+
Allow mandatory locks on an FS.
3925+
3926+
.. availability:: Linux.
3927+
3928+
.. versionadded:: 3.4
3929+
3930+
.. data:: ST_WRITE
3931+
3932+
Write on file/directory/symlink.
3933+
3934+
.. availability:: Linux.
3935+
3936+
.. versionadded:: 3.4
3937+
3938+
.. data:: ST_APPEND
3939+
3940+
Append-only file.
3941+
3942+
.. availability:: Linux.
3943+
3944+
.. versionadded:: 3.4
3945+
3946+
.. data:: ST_IMMUTABLE
3947+
3948+
Immutable file.
3949+
3950+
.. availability:: Linux.
3951+
3952+
.. versionadded:: 3.4
3953+
3954+
.. data:: ST_NOATIME
3955+
3956+
Do not update access times.
3957+
3958+
.. availability:: Linux.
3959+
3960+
.. versionadded:: 3.4
3961+
3962+
.. data:: ST_NODIRATIME
3963+
3964+
Do not update directory access times.
3965+
3966+
.. availability:: Linux.
3967+
3968+
.. versionadded:: 3.4
3969+
3970+
.. data:: ST_RELATIME
3971+
3972+
Update atime relative to mtime/ctime.
3973+
3974+
.. availability:: Linux.
3975+
3976+
.. versionadded:: 3.4
38293977

38303978

38313979
.. data:: supports_dir_fd
@@ -5107,7 +5255,7 @@ written in Python, such as a mail server's external command delivery program.
51075255
Lock program segments into memory. The value of *op* (defined in
51085256
``<sys/lock.h>``) determines which segments are locked.
51095257

5110-
.. availability:: Unix, not WASI, not iOS.
5258+
.. availability:: Unix, not WASI, not macOS, not iOS.
51115259

51125260

51135261
.. function:: popen(cmd, mode='r', buffering=-1)

0 commit comments

Comments
 (0)