Skip to content

Commit dab8354

Browse files
Issue #19207: Improved cross-references in the os, os.path, and posix modules
documentation.
1 parent 5e1c053 commit dab8354

File tree

3 files changed

+36
-34
lines changed

3 files changed

+36
-34
lines changed

Doc/library/os.path.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ the :mod:`glob` module.)
273273
.. function:: samestat(stat1, stat2)
274274

275275
Return ``True`` if the stat tuples *stat1* and *stat2* refer to the same file.
276-
These structures may have been returned by :func:`fstat`, :func:`lstat`, or
277-
:func:`stat`. This function implements the underlying comparison used by
278-
:func:`samefile` and :func:`sameopenfile`.
276+
These structures may have been returned by :func:`os.fstat`,
277+
:func:`os.lstat`, or :func:`os.stat`. This function implements the
278+
underlying comparison used by :func:`samefile` and :func:`sameopenfile`.
279279

280280
Availability: Unix.
281281

Doc/library/os.rst

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ process will then be assigned 3, 4, 5, and so forth. The name "file descriptor"
643643
is slightly deceptive; on Unix platforms, sockets and pipes are also referenced
644644
by file descriptors.
645645

646-
The :meth:`~file.fileno` method can be used to obtain the file descriptor
646+
The :meth:`~io.IOBase.fileno` method can be used to obtain the file descriptor
647647
associated with a :term:`file object` when required. Note that using the file
648648
descriptor directly will bypass the file object methods, ignoring aspects such
649649
as internal buffering of data.
@@ -660,7 +660,7 @@ as internal buffering of data.
660660
This function is intended for low-level I/O and must be applied to a file
661661
descriptor as returned by :func:`os.open` or :func:`pipe`. To close a "file
662662
object" returned by the built-in function :func:`open` or by :func:`popen` or
663-
:func:`fdopen`, use its :meth:`~file.close` method.
663+
:func:`fdopen`, use its :meth:`~io.IOBase.close` method.
664664

665665

666666
.. function:: closerange(fd_low, fd_high)
@@ -821,7 +821,7 @@ as internal buffering of data.
821821
Set the current position of file descriptor *fd* to position *pos*, modified
822822
by *how*: :const:`SEEK_SET` or ``0`` to set the position relative to the
823823
beginning of the file; :const:`SEEK_CUR` or ``1`` to set it relative to the
824-
current position; :const:`os.SEEK_END` or ``2`` to set it relative to the end of
824+
current position; :const:`SEEK_END` or ``2`` to set it relative to the end of
825825
the file. Return the new cursor position in bytes, starting from the beginning.
826826

827827
Availability: Unix, Windows.
@@ -1938,7 +1938,7 @@ features:
19381938

19391939
.. data:: supports_dir_fd
19401940

1941-
A :class:`~collections.Set` object indicating which functions in the
1941+
A :class:`~collections.abc.Set` object indicating which functions in the
19421942
:mod:`os` module permit use of their *dir_fd* parameter. Different platforms
19431943
provide different functionality, and an option that might work on one might
19441944
be unsupported on another. For consistency's sakes, functions that support
@@ -1960,7 +1960,7 @@ features:
19601960

19611961
.. data:: supports_effective_ids
19621962

1963-
A :class:`~collections.Set` object indicating which functions in the
1963+
A :class:`~collections.abc.Set` object indicating which functions in the
19641964
:mod:`os` module permit use of the *effective_ids* parameter for
19651965
:func:`os.access`. If the local platform supports it, the collection will
19661966
contain :func:`os.access`, otherwise it will be empty.
@@ -1978,7 +1978,7 @@ features:
19781978

19791979
.. data:: supports_fd
19801980

1981-
A :class:`~collections.Set` object indicating which functions in the
1981+
A :class:`~collections.abc.Set` object indicating which functions in the
19821982
:mod:`os` module permit specifying their *path* parameter as an open file
19831983
descriptor. Different platforms provide different functionality, and an
19841984
option that might work on one might be unsupported on another. For
@@ -1999,7 +1999,7 @@ features:
19991999

20002000
.. data:: supports_follow_symlinks
20012001

2002-
A :class:`~collections.Set` object indicating which functions in the
2002+
A :class:`~collections.abc.Set` object indicating which functions in the
20032003
:mod:`os` module permit use of their *follow_symlinks* parameter. Different
20042004
platforms provide different functionality, and an option that might work on
20052005
one might be unsupported on another. For consistency's sakes, functions that
@@ -2348,7 +2348,7 @@ Process Management
23482348

23492349
These functions may be used to create and manage processes.
23502350

2351-
The various :func:`exec\*` functions take a list of arguments for the new
2351+
The various :func:`exec\* <execl>` functions take a list of arguments for the new
23522352
program loaded into the process. In each case, the first of these arguments is
23532353
passed to the new program as its own name rather than as an argument a user may
23542354
have typed on a command line. For the C programmer, this is the ``argv[0]``
@@ -2386,9 +2386,9 @@ to be ignored.
23862386
descriptors are not flushed, so if there may be data buffered
23872387
on these open files, you should flush them using
23882388
:func:`sys.stdout.flush` or :func:`os.fsync` before calling an
2389-
:func:`exec\*` function.
2389+
:func:`exec\* <execl>` function.
23902390

2391-
The "l" and "v" variants of the :func:`exec\*` functions differ in how
2391+
The "l" and "v" variants of the :func:`exec\* <execl>` functions differ in how
23922392
command-line arguments are passed. The "l" variants are perhaps the easiest
23932393
to work with if the number of parameters is fixed when the code is written; the
23942394
individual parameters simply become additional parameters to the :func:`execl\*`
@@ -2400,7 +2400,7 @@ to be ignored.
24002400
The variants which include a "p" near the end (:func:`execlp`,
24012401
:func:`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the
24022402
:envvar:`PATH` environment variable to locate the program *file*. When the
2403-
environment is being replaced (using one of the :func:`exec\*e` variants,
2403+
environment is being replaced (using one of the :func:`exec\*e <execl>` variants,
24042404
discussed in the next paragraph), the new environment is used as the source of
24052405
the :envvar:`PATH` variable. The other variants, :func:`execl`, :func:`execle`,
24062406
:func:`execv`, and :func:`execve`, will not use the :envvar:`PATH` variable to
@@ -2646,7 +2646,6 @@ written in Python, such as a mail server's external command delivery program.
26462646

26472647

26482648
.. function:: popen(...)
2649-
:noindex:
26502649

26512650
Run child processes, returning opened pipes for communications. These functions
26522651
are described in section :ref:`os-newstreams`.
@@ -2674,7 +2673,7 @@ written in Python, such as a mail server's external command delivery program.
26742673
process. On Windows, the process id will actually be the process handle, so can
26752674
be used with the :func:`waitpid` function.
26762675

2677-
The "l" and "v" variants of the :func:`spawn\*` functions differ in how
2676+
The "l" and "v" variants of the :func:`spawn\* <spawnl>` functions differ in how
26782677
command-line arguments are passed. The "l" variants are perhaps the easiest
26792678
to work with if the number of parameters is fixed when the code is written; the
26802679
individual parameters simply become additional parameters to the
@@ -2686,7 +2685,7 @@ written in Python, such as a mail server's external command delivery program.
26862685
The variants which include a second "p" near the end (:func:`spawnlp`,
26872686
:func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the
26882687
:envvar:`PATH` environment variable to locate the program *file*. When the
2689-
environment is being replaced (using one of the :func:`spawn\*e` variants,
2688+
environment is being replaced (using one of the :func:`spawn\*e <spawnl>` variants,
26902689
discussed in the next paragraph), the new environment is used as the source of
26912690
the :envvar:`PATH` variable. The other variants, :func:`spawnl`,
26922691
:func:`spawnle`, :func:`spawnv`, and :func:`spawnve`, will not use the
@@ -2720,7 +2719,7 @@ written in Python, such as a mail server's external command delivery program.
27202719
.. data:: P_NOWAIT
27212720
P_NOWAITO
27222721

2723-
Possible values for the *mode* parameter to the :func:`spawn\*` family of
2722+
Possible values for the *mode* parameter to the :func:`spawn\* <spawnl>` family of
27242723
functions. If either of these values is given, the :func:`spawn\*` functions
27252724
will return as soon as the new process has been created, with the process id as
27262725
the return value.
@@ -2730,7 +2729,7 @@ written in Python, such as a mail server's external command delivery program.
27302729

27312730
.. data:: P_WAIT
27322731

2733-
Possible value for the *mode* parameter to the :func:`spawn\*` family of
2732+
Possible value for the *mode* parameter to the :func:`spawn\* <spawnl>` family of
27342733
functions. If this is given as *mode*, the :func:`spawn\*` functions will not
27352734
return until the new process has run to completion and will return the exit code
27362735
of the process the run is successful, or ``-signal`` if a signal kills the
@@ -2742,11 +2741,11 @@ written in Python, such as a mail server's external command delivery program.
27422741
.. data:: P_DETACH
27432742
P_OVERLAY
27442743

2745-
Possible values for the *mode* parameter to the :func:`spawn\*` family of
2744+
Possible values for the *mode* parameter to the :func:`spawn\* <spawnl>` family of
27462745
functions. These are less portable than those listed above. :const:`P_DETACH`
27472746
is similar to :const:`P_NOWAIT`, but the new process is detached from the
27482747
console of the calling process. If :const:`P_OVERLAY` is used, the current
2749-
process will be replaced; the :func:`spawn\*` function will not return.
2748+
process will be replaced; the :func:`spawn\* <spawnl>` function will not return.
27502749

27512750
Availability: Windows.
27522751

@@ -2918,17 +2917,18 @@ written in Python, such as a mail server's external command delivery program.
29182917
(shifting makes cross-platform use of the function easier). A *pid* less than or
29192918
equal to ``0`` has no special meaning on Windows, and raises an exception. The
29202919
value of integer *options* has no effect. *pid* can refer to any process whose
2921-
id is known, not necessarily a child process. The :func:`spawn` functions called
2922-
with :const:`P_NOWAIT` return suitable process handles.
2920+
id is known, not necessarily a child process. The :func:`spawn\* <spawnl>`
2921+
functions called with :const:`P_NOWAIT` return suitable process handles.
29232922

29242923

29252924
.. function:: wait3(options)
29262925

29272926
Similar to :func:`waitpid`, except no process id argument is given and a
29282927
3-element tuple containing the child's process id, exit status indication, and
29292928
resource usage information is returned. Refer to :mod:`resource`.\
2930-
:func:`getrusage` for details on resource usage information. The option
2931-
argument is the same as that provided to :func:`waitpid` and :func:`wait4`.
2929+
:func:`~resource.getrusage` for details on resource usage information. The
2930+
option argument is the same as that provided to :func:`waitpid` and
2931+
:func:`wait4`.
29322932

29332933
Availability: Unix.
29342934

@@ -2937,9 +2937,9 @@ written in Python, such as a mail server's external command delivery program.
29372937

29382938
Similar to :func:`waitpid`, except a 3-element tuple, containing the child's
29392939
process id, exit status indication, and resource usage information is returned.
2940-
Refer to :mod:`resource`.\ :func:`getrusage` for details on resource usage
2941-
information. The arguments to :func:`wait4` are the same as those provided to
2942-
:func:`waitpid`.
2940+
Refer to :mod:`resource`.\ :func:`~resource.getrusage` for details on
2941+
resource usage information. The arguments to :func:`wait4` are the same
2942+
as those provided to :func:`waitpid`.
29432943

29442944
Availability: Unix.
29452945

@@ -3272,8 +3272,9 @@ Higher-level operations on pathnames are defined in the :mod:`os.path` module.
32723272

32733273
.. data:: defpath
32743274

3275-
The default search path used by :func:`exec\*p\*` and :func:`spawn\*p\*` if the
3276-
environment doesn't have a ``'PATH'`` key. Also available via :mod:`os.path`.
3275+
The default search path used by :func:`exec\*p\* <execl>` and
3276+
:func:`spawn\*p\* <spawnl>` if the environment doesn't have a ``'PATH'``
3277+
key. Also available via :mod:`os.path`.
32773278

32783279

32793280
.. data:: linesep

Doc/library/posix.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ systems the :mod:`posix` module is not available, but a subset is always
1919
available through the :mod:`os` interface. Once :mod:`os` is imported, there is
2020
*no* performance penalty in using it instead of :mod:`posix`. In addition,
2121
:mod:`os` provides some additional functionality, such as automatically calling
22-
:func:`putenv` when an entry in ``os.environ`` is changed.
22+
:func:`~os.putenv` when an entry in ``os.environ`` is changed.
2323

2424
Errors are reported as exceptions; the usual exceptions are given for type
2525
errors, while errors reported by the system calls raise :exc:`OSError`.
@@ -74,9 +74,10 @@ In addition to many functions described in the :mod:`os` module documentation,
7474
pathname of your home directory, equivalent to ``getenv("HOME")`` in C.
7575

7676
Modifying this dictionary does not affect the string environment passed on by
77-
:func:`execv`, :func:`popen` or :func:`system`; if you need to change the
78-
environment, pass ``environ`` to :func:`execve` or add variable assignments and
79-
export statements to the command string for :func:`system` or :func:`popen`.
77+
:func:`~os.execv`, :func:`~os.popen` or :func:`~os.system`; if you need to
78+
change the environment, pass ``environ`` to :func:`~os.execve` or add
79+
variable assignments and export statements to the command string for
80+
:func:`~os.system` or :func:`~os.popen`.
8081

8182
.. versionchanged:: 3.2
8283
On Unix, keys and values are bytes.

0 commit comments

Comments
 (0)