Skip to content

Conversation

@FFY00
Copy link
Member

@FFY00 FFY00 commented Dec 15, 2024

PYTHONHOME should only override the base prefix calculation, it should have no effect on detecting if we are running inside a virtual environment.

PYTHONHOME should only override the base prefix calculation, it should
have no effect on detecting if we are running inside a virtual
environment.

Signed-off-by: Filipe Laíns <[email protected]
@FFY00
Copy link
Member Author

FFY00 commented Dec 15, 2024

Without the fix prefix and exec_prefix would be set to PYTHONHOME:

test test_getpath failed -- Traceback (most recent call last):
  File "/home/anubis/git/cpython/Lib/test/test_getpath.py", line 865, in test_PYTHONHOME_in_venv
    self.assertEqual(expected, actual)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
AssertionError: {'exe[37 chars]': '/venv', 'exec_prefix': '/venv', 'base_pref[206 chars]ad']} != {'exe[37 chars]': '/pythonhome', 'exec_prefix': '/pythonhome'[218 chars]ad']}
  {'base_exec_prefix': '/pythonhome',
   'base_prefix': '/pythonhome',
-  'exec_prefix': '/venv',
?                   ^ --

+  'exec_prefix': '/pythonhome',
?                   ^^^^^^^^^

   'executable': '/venv/bin/python',
   'module_search_paths': ['/pythonhome/lib/python98.zip',
                           '/pythonhome/lib/python9.8',
                           '/pythonhome/lib/python9.8/lib-dynload'],
   'module_search_paths_set': 1,
-  'prefix': '/venv'}
+  'prefix': '/pythonhome'}

@FFY00 FFY00 changed the title GH-126985: Don't override venv dectection whith PYTHONHOME GH-126985: Don't override venv dectection with PYTHONHOME Dec 15, 2024
@FFY00 FFY00 changed the title GH-126985: Don't override venv dectection with PYTHONHOME GH-126985: Don't override venv detection with PYTHONHOME Dec 15, 2024
@FFY00 FFY00 merged commit b74c8f5 into python:main Dec 15, 2024
40 checks passed
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant