Closed as not planned
Description
Bug report
Bug description:
Issue:
The test_safe_path function in test_pdb.py is failing. When PYTHONSAFEPATH is set to '1', sys.path[0] still includes the current working directory, which is unexpected.
Steps to Reproduce:
- Run the Python test suite, specifically focusing on test_pdb.
- Observe that test_safe_path fails with the following error:
AssertionError: 'sys.path[0] is /Users/joon/projects/cpython/build/test_python_68610æ/tempcwd' unexpectedly found in '> /Users/joon/projects/cpython/build/test_python_68610æ/tempcwd/main.py(2)<module>()
-> import sys
(Pdb) sys.path[0] is /Users/joon/projects/cpython/build/test_python_68610æ/tempcwd/$PYTHONPATH
The program finished and will be restarted
> /Users/joon/projects/cpython/build/test_python_68610æ/tempcwd/main.py(2)<module>()
-> import sys
(Pdb)
'
Expected Behavior:
When PYTHONSAFEPATH is set to '1', sys.path[0] should not include the current working directory.
Actual Behavior:
sys.path[0] includes the current working directory, and there's an unexpected $PYTHONPATH appended to the path.
Environment:
- Python version: 3.14.0
- OS: macos sonoma 14.1.1 (apple silicon)
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS