[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-04-08 Thread Brett Cannon
Brett Cannon added the comment: I simplified Wolfgang's patch by simply using os.path.exists(). That eliminated the one place where os.path.isdir() was in use that was too specific to directories where files were reasonable to expect. I also quickly tweaked the docs for the site module in

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-04-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset 09dc97edf454 by Brett Cannon in branch '3.5': Issue #26587: Remove an incorrect statement from the docs https://hg.python.org/cpython/rev/09dc97edf454 New changeset 94d5c57ee835 by Brett Cannon in branch 'default': Merge w/ 3.5 for issue #26587

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-04-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset bd1af1a97c2e by Brett Cannon in branch 'default': Issue #26587: Allow .pth files to specify file paths as well as https://hg.python.org/cpython/rev/bd1af1a97c2e -- nosy: +python-dev ___ Python tracker

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-26 Thread Brett Cannon
Changes by Brett Cannon : -- assignee: -> brett.cannon ___ Python tracker ___ ___

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-26 Thread Wolfgang Langner
Wolfgang Langner added the comment: Ok, I implemented point 3. Check if it is a dir or file and makepath only in this case. All other entries are added unmodified to the set. Added a test case also for an URL path. I think duplicate detection is now improved and it should break nothing.

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-22 Thread SilentGhost
SilentGhost added the comment: I still think my fix is more appropriate as it ensures that known_paths and sys.path stay connected somehow. -- ___ Python tracker

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-22 Thread Brett Cannon
Brett Cannon added the comment: And the code under discussion can be found at https://hg.python.org/cpython/file/default/Lib/site.py#l133 -- ___ Python tracker

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-22 Thread Brett Cannon
Brett Cannon added the comment: Unfortunately you can't simply remove that directory check because you don't want to blindly normalize case. If someone put some token value on sys.path for their use that was case-sensitive even on a case-insensitive OS then the proposed change would break

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-22 Thread Wolfgang Langner
Wolfgang Langner added the comment: I think a fix for 3.6 only is ok, because it changes behaviour. But this is only an internal function with a "_". Should I add a test with a temporary created pth file? -- ___ Python tracker

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-20 Thread Wolfgang Langner
Wolfgang Langner added the comment: Extended unit test for the issue and patch for site.py. -- Added file: http://bugs.python.org/file42225/site.patch ___ Python tracker

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-20 Thread SilentGhost
SilentGhost added the comment: Thanks for this, Mandeep. I don't think it is entirely the same issue that Wolfgang is describing. He's particularly concerned about the clash of .zip files from the sys.path with ones coming from .pth files for example. And while the proposed fix would resolve

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-19 Thread Mandeep Singh Grang
Mandeep Singh Grang added the comment: 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',

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-19 Thread Wolfgang Langner
New submission from Wolfgang Langner: In site.py there is the internal function _init_pathinfo() This function builds a set of path entries from sys.path. This is used to avoid duplicate entries in sys.path. But this function has a check if it is a directory with os.path.isdir(...). All this

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-18 Thread SilentGhost
SilentGhost added the comment: Could you provide a code example of your using addsitedir that results in duplicates? -- nosy: +SilentGhost stage: -> test needed versions: -Python 3.4 ___ Python tracker