This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mgrang
Recipients SilentGhost, mgrang, tds333
Date 2016-03-19.23:37:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458430648.81.0.56970802193.issue26587@psf.upfronthosting.co.za>
In-reply-to
Content
Here is a testcase to reproduce the issue:

> cat test.py
import site, sys
site.addsitedir('/foo/bar')
print (sys.path)

This prints just a single instance of '/foo/bar':

['/local/mnt/workspace/python/tst', '/foo/bar', '/usr/local/lib/python36.zip', '/local/mnt/workspace/python/src/Lib', '/local/mnt/workspace/python/src/Lib/plat-linux', '/local/mnt/workspace/python/build/build/lib.linux-x86_64-3.6-pydebug']

Now if we explicitly set PYTHONPATH to include '/foo/bar'
> export PYTHONPATH=/foo/bar

and then run test.py here is the output:

['/local/mnt/workspace/python/tst', '/foo/bar', '/usr/local/lib/python36.zip', '/local/mnt/workspace/python/src/Lib', '/local/mnt/workspace/python/src/Lib/plat-linux', '/local/mnt/workspace/python/build/build/lib.linux-x86_64-3.6-pydebug', '/foo/bar']

We see that there are duplicate entries for '/foo/bar'.

As Wolfgang rightly said the issue comes from the check for
"if os.path.isdir(dir)" inside _init_pathinfo() in site.py.
On removing this check I no longer see the duplicate entry for '/foo/bar'.

But since this is the first bug I am looking at I am not sure of the implications of removing this check. Can someone please confirm that what I see is indeed a failing test case, or is this the intended behavior?

Thanks,
Mandeep
History
Date User Action Args
2016-03-19 23:37:28mgrangsetrecipients: + mgrang, tds333, SilentGhost
2016-03-19 23:37:28mgrangsetmessageid: <1458430648.81.0.56970802193.issue26587@psf.upfronthosting.co.za>
2016-03-19 23:37:28mgranglinkissue26587 messages
2016-03-19 23:37:28mgrangcreate