diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-06-05-10-05-05.gh-issue-120037.QyZNce.rst b/Misc/NEWS.d/next/Core and Builtins/2024-06-05-10-05-05.gh-issue-120037.QyZNce.rst new file mode 100644 index 00000000000000..6b045fe1dcc0da --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2024-06-05-10-05-05.gh-issue-120037.QyZNce.rst @@ -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. diff --git a/Modules/getpath.py b/Modules/getpath.py index bc7053224aaf16..431ac4af309438 100644 --- a/Modules/getpath.py +++ b/Modules/getpath.py @@ -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()