Skip to content

gh-120037: User site packages are being added when site module is enabled in _pth file #120100

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix user site packages directory being added to `sys.path` when site module is enabled in `._pth` file. Patch by Tanzim Husain.
Copy link
Member

@zooba zooba Jun 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Fix user site packages directory being added to `sys.path` when site module is enabled in `._pth` file. Patch by Tanzim Husain.
Fix user site packages directory being enabled when a ``._pth`` file has been used. Patch by Tanzim Husain.

This is a ReST file, not Markdown, so the syntax is slightly different. This should work to allow the docs builds to pass.

Edit And simplified the text a little.

1 change: 1 addition & 0 deletions Modules/getpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ def search_up(prefix, *landmarks, test=isfile):
config['use_environment'] = 0
config['site_import'] = 0
config['safe_path'] = 1
config['user_site_directory'] = 0
pythonpath = []
for line in pth:
line = line.partition('#')[0].strip()
Expand Down