gh-120037: User site packages are being added when site module is enabled in _pth file#120100
gh-120037: User site packages are being added when site module is enabled in _pth file#120100tanzim wants to merge 4 commits intopython:mainfrom
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.
| 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: |
|
Seems like we're not getting a CLA, so I created #137428 to get this change in. |
Don't add user site package directory to
sys.pathwhen a distribution specific_.pthexists 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
_pthfiles enabled?Thanks to @eryksun for the fix suggestion.