-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Blank lines in .pth file cause a duplicate sys.path entry #77870
Comments
The Example: $ python -c 'import sys; print(sys.path)'
['', '/home/smith/.virtualenvs/foo/lib/python36.zip', '/home/smith/.virtualenvs/foo/lib/python3.6', '/home/smith/.virtualenvs/foo/lib/python3.6/lib-dynload', '/usr/lib/python3.6', '/home/smith/.virtualenvs/foo/lib/python3.6/site-packages']
$ echo > /home/smith/.virtualenvs/foo/lib/python3.6/site-packages/test.pth
$ python -c 'import sys; print(sys.path)'
['', '/home/smith/.virtualenvs/foo/lib/python36.zip', '/home/smith/.virtualenvs/foo/lib/python3.6', '/home/smith/.virtualenvs/foo/lib/python3.6/lib-dynload', '/usr/lib/python3.6', '/home/smith/.virtualenvs/foo/lib/python3.6/site-packages', '/home/smith/.virtualenvs/foo/lib/python3.6/site-packages'] A patch fixing this is attached to bpo-29326, but was ignored when that issue turned out to be caused by something else. |
If this is actually an issue, and not just a documentation lapse I can create a pull request from my original patch. |
It's definitely a bug and not a documentation lapse. There's no reason why blank lines should have that effect, and no indication in the code that this was intentional. |
I can take this and have a PR |
Created a PR: #64878 I did see some of the changes are already in the code for example, test_underpth_nosite_file.test_sity.py already had pth_lines filter out: ''. I think it's because this issue relevant only for 3.6? |
This is certainly a bug fix, but since it may break backwards-compatibility in delicate ways, I'm not going to backport it to earlier versions. Expect this to land in 3.10. |
Thanks for bringing this up again Malcolm, for the original Patch Ammar, and for the work on the PR Ido! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: