From bc1cda06b632030898702d206c1d30e2f376fc6e Mon Sep 17 00:00:00 2001 From: Tanzim Date: Wed, 5 Jun 2024 09:48:24 +0100 Subject: [PATCH 1/2] Disable user site directory when ._pth file is present --- Modules/getpath.py | 1 + 1 file changed, 1 insertion(+) 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() From 20266715df449d12a37d5a5cda80a02806be26aa Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 10:05:05 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2024-06-05-10-05-05.gh-issue-120037.QyZNce.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2024-06-05-10-05-05.gh-issue-120037.QyZNce.rst 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.