]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-41376: Fix the documentation of `site.getusersitepackages()` (GH-21602)
authorPhil Elson <pelson.pub@gmail.com>
Thu, 8 Oct 2020 06:37:46 +0000 (08:37 +0200)
committerGitHub <noreply@github.com>
Thu, 8 Oct 2020 06:37:46 +0000 (15:37 +0900)
commit35f041dd0171f575fc3adce1709b31fdf45a5ff6
treef5639ead3eed408325c59d641f0aa76fdead646a
parent4e0ce820586e93cfcefb16c2a3df8eaefc54cbca
bpo-41376: Fix the documentation of `site.getusersitepackages()` (GH-21602)

`site.getusersitepackages()` returns the location of the user-specific site-packages directory
even when the user-specific site-packages is disabled.

```
$ python -s -m site
sys.path = [
    '/home/user/conda/lib/python37.zip',
    '/home/user/conda/lib/python3.7',
    '/home/user/conda/lib/python3.7/lib-dynload',
    '/home/user/conda/lib/python3.7/site-packages',
]
USER_BASE: '/home/user/.local' (exists)
USER_SITE: '/home/user/.local/lib/python3.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: False
```

It was not practical to prevent the function from returning None if user-specific site-packages are disabled, since there are other uses of the function which are relying on this behaviour (e.g. `python -m site`).
Doc/library/site.rst