Message318137
The `site` module documentation says that in .pth files, "Blank lines and lines beginning with # are skipped.". However, the implementation does not actually skip blank lines. It then joins the empty string to the site-packages directory, resulting in the site-packages directory being added to sys.path a second time.
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 issue 29326, but was ignored when that issue turned out to be caused by something else. |
|
Date |
User |
Action |
Args |
2018-05-29 23:03:14 | Malcolm Smith | set | recipients:
+ Malcolm Smith |
2018-05-29 23:03:14 | Malcolm Smith | set | messageid: <1527634994.48.0.682650639539.issue33689@psf.upfronthosting.co.za> |
2018-05-29 23:03:14 | Malcolm Smith | link | issue33689 messages |
2018-05-29 23:03:14 | Malcolm Smith | create | |
|