-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
base: main
Are you sure you want to change the base?
Conversation
The following commit authors need to sign the Contributor License Agreement: |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Let's update Basic test: @support.requires_subprocess()
def test_underpth_no_user_site(self):
pth_lines = [test.support.STDLIB_DIR, 'import site']
exe_file = self._create_underpth_exe(pth_lines)
p = subprocess.run([exe_file, '-X', 'utf8', '-c',
'import sys; '
'sys.exit(not sys.flags.no_user_site)'])
self.assertEqual(p.returncode, 0, "sys.flags.no_user_site was 0") |
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
The following commit authors need to sign the Contributor License Agreement: |
Don't add user site package directory to
sys.path
when a distribution specific_.pth
exists with site import enabled.I'd prefer that we add some tests for this, however none of the embedding tests looks like they test with
_pth
files enabled?Thanks to @eryksun for the fix suggestion.