You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_pdb fails: Unexpected sys.path[0] behavior with PYTHONSAFEPATH set #123121
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.
changed the title [-][BUG] test_pdb fails: Unexpected sys.path[0] behavior with PYTHONSAFEPATH set[/-][+] test_pdb fails: Unexpected sys.path[0] behavior with PYTHONSAFEPATH set[/+]on Aug 18, 2024
changed the title [-] test_pdb fails: Unexpected sys.path[0] behavior with PYTHONSAFEPATH set[/-][+]test_pdb fails: Unexpected sys.path[0] behavior with PYTHONSAFEPATH set[/+]on Aug 18, 2024
Activity
Eclips4 commentedon Aug 18, 2024
cc @gaogaotiantian
[-][BUG] test_pdb fails: Unexpected sys.path[0] behavior with PYTHONSAFEPATH set[/-][+] test_pdb fails: Unexpected sys.path[0] behavior with PYTHONSAFEPATH set[/+][-] test_pdb fails: Unexpected sys.path[0] behavior with PYTHONSAFEPATH set[/-][+]test_pdb fails: Unexpected sys.path[0] behavior with PYTHONSAFEPATH set[/+]gaogaotiantian commentedon Aug 18, 2024
How did you run
test_safe_pathwithPYTHONSAFEPATH = 1? It should be skipped (not that it's what I had in mind when I wrote the test).xncbf commentedon Aug 19, 2024
The above command fails when executed after the build. No other preliminary work is needed.
gaogaotiantian commentedon Aug 19, 2024
Are you able to repro this with
Can you copy/paste the full output? Is it because of mac that the test actually ran?
picnixz commentedon Dec 2, 2024
Closing as
cannot reproducesince the OP did not reply for a while.