Author mgrang
Recipients SilentGhost, mgrang, tds333
Date 2016-03-19.23:37:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Here is a testcase to reproduce the issue:

> cat
import site, sys
print (sys.path)

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

['/local/mnt/workspace/python/tst', '/foo/bar', '/usr/local/lib/', '/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 here is the output:

['/local/mnt/workspace/python/tst', '/foo/bar', '/usr/local/lib/', '/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
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?

Date User Action Args
2016-03-19 23:37:28mgrangsetrecipients: + mgrang, tds333, SilentGhost
2016-03-19 23:37:28mgrangsetmessageid: <>
2016-03-19 23:37:28mgranglinkissue26587 messages
2016-03-19 23:37:28mgrangcreate