Skip to content

Commit 31097df

Browse files
gh-101100: Fix sphinx warnings in library/site.rst (#110144)
Co-authored-by: Alex Waygood <[email protected]>
1 parent a431a0f commit 31097df

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

Doc/library/exceptions.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,16 @@ The following exceptions are the exceptions that are usually raised.
220220
load a module. Also raised when the "from list" in ``from ... import``
221221
has a name that cannot be found.
222222

223-
The :attr:`name` and :attr:`path` attributes can be set using keyword-only
224-
arguments to the constructor. When set they represent the name of the module
225-
that was attempted to be imported and the path to any file which triggered
226-
the exception, respectively.
223+
The optional *name* and *path* keyword-only arguments
224+
set the corresponding attributes:
225+
226+
.. attribute:: name
227+
228+
The name of the module that was attempted to be imported.
229+
230+
.. attribute:: path
231+
232+
The path to any file which triggered the exception.
227233

228234
.. versionchanged:: 3.3
229235
Added the :attr:`name` and :attr:`path` attributes.

Doc/library/site.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Importing this module will append site-specific paths to the module search path
1919
and add a few builtins, unless :option:`-S` was used. In that case, this module
2020
can be safely imported with no automatic modifications to the module search path
2121
or additions to the builtins. To explicitly trigger the usual site-specific
22-
additions, call the :func:`site.main` function.
22+
additions, call the :func:`main` function.
2323

2424
.. versionchanged:: 3.3
2525
Importing the module used to trigger paths manipulation even when using
@@ -109,32 +109,40 @@ directory precedes the :file:`foo` directory because :file:`bar.pth` comes
109109
alphabetically before :file:`foo.pth`; and :file:`spam` is omitted because it is
110110
not mentioned in either path configuration file.
111111

112-
.. index:: pair: module; sitecustomize
112+
:mod:`sitecustomize`
113+
--------------------
114+
115+
.. module:: sitecustomize
113116

114117
After these path manipulations, an attempt is made to import a module named
115118
:mod:`sitecustomize`, which can perform arbitrary site-specific customizations.
116119
It is typically created by a system administrator in the site-packages
117120
directory. If this import fails with an :exc:`ImportError` or its subclass
118-
exception, and the exception's :attr:`name` attribute equals to ``'sitecustomize'``,
121+
exception, and the exception's :attr:`~ImportError.name`
122+
attribute equals to ``'sitecustomize'``,
119123
it is silently ignored. If Python is started without output streams available, as
120124
with :file:`pythonw.exe` on Windows (which is used by default to start IDLE),
121125
attempted output from :mod:`sitecustomize` is ignored. Any other exception
122126
causes a silent and perhaps mysterious failure of the process.
123127

124-
.. index:: pair: module; usercustomize
128+
:mod:`usercustomize`
129+
--------------------
130+
131+
.. module:: usercustomize
125132

126133
After this, an attempt is made to import a module named :mod:`usercustomize`,
127134
which can perform arbitrary user-specific customizations, if
128-
:data:`ENABLE_USER_SITE` is true. This file is intended to be created in the
135+
:data:`~site.ENABLE_USER_SITE` is true. This file is intended to be created in the
129136
user site-packages directory (see below), which is part of ``sys.path`` unless
130137
disabled by :option:`-s`. If this import fails with an :exc:`ImportError` or
131-
its subclass exception, and the exception's :attr:`name` attribute equals to
132-
``'usercustomize'``, it is silently ignored.
138+
its subclass exception, and the exception's :attr:`~ImportError.name`
139+
attribute equals to ``'usercustomize'``, it is silently ignored.
133140

134141
Note that for some non-Unix systems, ``sys.prefix`` and ``sys.exec_prefix`` are
135142
empty, and the path manipulations are skipped; however the import of
136143
:mod:`sitecustomize` and :mod:`usercustomize` is still attempted.
137144

145+
.. currentmodule:: site
138146

139147
.. _rlcompleter-config:
140148

Doc/tools/.nitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,13 @@ Doc/library/select.rst
106106
Doc/library/selectors.rst
107107
Doc/library/shelve.rst
108108
Doc/library/signal.rst
109-
Doc/library/site.rst
110109
Doc/library/smtplib.rst
111110
Doc/library/socket.rst
112111
Doc/library/socketserver.rst
113112
Doc/library/ssl.rst
114113
Doc/library/stdtypes.rst
115114
Doc/library/string.rst
116115
Doc/library/subprocess.rst
117-
Doc/library/sys_path_init.rst
118116
Doc/library/syslog.rst
119117
Doc/library/tarfile.rst
120118
Doc/library/tempfile.rst

0 commit comments

Comments
 (0)