8000 Make site documentation more clear (#5461) · python/cpython@a29ddf4 · GitHub
[go: up one dir, main page]

Skip to content

Commit a29ddf4

Browse files
authored
Make site documentation more clear (#5461)
Mention only ImportError caused by importing sitecustomize.py/usercustomize.py themselves will be silently ignored.
1 parent 2c7fd46 commit a29ddf4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Doc/library/site.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,22 @@ not mentioned in either path configuration file.
9797
After these path manipulations, an attempt is made to import a module named
9898
:mod:`sitecustomize`, which can perform arbitrary site-specific customizations.
9999
It is typically created by a system administrator in the site-packages
100-
directory. If this import fails with an :exc:`ImportError` exception, it is
101-
silently ignored. If Python is started without output streams available, as
100+
directory. If this import fails with an :exc:`ImportError` or its subclass
101+
exception, and the exception's :attr:`name` attribute equals to ``'sitecustomize'``,
102+
it is silently ignored. If Python is started without output streams available, as
102103
with :file:`pythonw.exe` on Windows (which is used by default to start IDLE),
103-
attempted output from :mod:`sitecustomize` is ignored. Any exception other
104-
than :exc:`ImportError` causes a silent and perhaps mysterious failure of the
105-
process.
104+
attempted output from :mod:`sitecustomize` is ignored. Any other exception
105+
causes a silent and perhaps mysterious failure of the process.
106106

107107
.. index:: module: usercustomize
108108

109109
After this, an attempt is made to import a module named :mod:`usercustomize`,
110110
which can perform arbitrary user-specific customizations, if
111111
:data:`ENABLE_USER_SITE` is true. This file is intended to be created in the
112112
user site-packages directory (see below), which is part of ``sys.path`` unless
113-
disabled by :option:`-s`. An :exc:`ImportError` will be silently ignored.
113+
disabled by :option:`-s`. If this import fails with an :exc:`ImportError` or
114+
its subclass exception, and the exception's :attr:`name` attribute equals to
115+
``'usercustomize'``, it is silently ignored.
114116

115117
Note that for some non-Unix systems, ``sys.prefix`` and ``sys.exec_prefix`` are
116118
empty, and the path manipulations are skipped; however the import of

0 commit comments

Comments
 (0)
0