Skip to content

[3.9] bpo-41376: Fix the documentation of site.getusersitepackages() (GH-21602) #22591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 8, 2020

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Oct 8, 2020

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).
(cherry picked from commit 35f041d)

Co-authored-by: Phil Elson pelson.pub@gmail.com

https://bugs.python.org/issue41376

…honGH-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`).
(cherry picked from commit 35f041d)

Co-authored-by: Phil Elson <pelson.pub@gmail.com>
@miss-islington
Copy link
Contributor Author

@pelson and @methane: Status check is done, and it's a success ✅ .

@miss-islington
Copy link
Contributor Author

@pelson and @methane: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 5b1fdca into python:3.9 Oct 8, 2020
@miss-islington miss-islington deleted the backport-35f041d-3.9 branch October 8, 2020 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants