diff options
author | native-api <ivan_pozdeev@mail.ru> | 2019-09-11 13:21:04 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-09-11 13:21:04 (GMT) |
commit | f9b5840fb4497a9e2ba2c1f01ad0dafba04c8496 (patch) | |
tree | d3a36453812d9f379f5284640cbed1b7cd70f4fd /Doc/library/site.rst | |
parent | 6f55b0394bce8e64a59c61f465fec8079a00e55c (diff) | |
download | cpython-f9b5840fb4497a9e2ba2c1f01ad0dafba04c8496.zip cpython-f9b5840fb4497a9e2ba2c1f01ad0dafba04c8496.tar.gz cpython-f9b5840fb4497a9e2ba2c1f01ad0dafba04c8496.tar.bz2 |
bpo-33944: note about the intended use of code in .pth files (GH-10131)
https://bugs.python.org/issue33944
Diffstat (limited to 'Doc/library/site.rst')
-rw-r--r-- | Doc/library/site.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Doc/library/site.rst b/Doc/library/site.rst index 9e4d402..e1ca160 100644 --- a/Doc/library/site.rst +++ b/Doc/library/site.rst @@ -61,6 +61,19 @@ directory rather than a file. No item is added to ``sys.path`` more than once. Blank lines and lines beginning with ``#`` are skipped. Lines starting with ``import`` (followed by space or tab) are executed. +.. note:: + + An executable line in a :file:`.pth` file is run at every Python startup, + regardless of whether a particular module is actually going to be used. + Its impact should thus be kept to a minimum. + The primary intended purpose of executable lines is to make the + corresponding module(s) importable + (load 3rd-party import hooks, adjust :envvar:`PATH` etc). + Any other initialization is supposed to be done upon a module's + actual import, if and when it happens. + Limiting a code chunk to a single line is a deliberate measure + to discourage putting anything more complex here. + .. index:: single: package triple: path; configuration; file |