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

Wolfgang Langner report at bugs.python.org
Fri Mar 18 06:23:00 EDT 2016


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 is fine as long as someone has a .zip file in sys.path or a zipfile subpath. Then the path entry is not part of the set. With this duplicate detection with none directories does not work.

The fix is as simple as removing the os.path.isdir(...) line and fixing the indent. Also the docstring should be modified.

Detected by using this function in a project reusing addsitedir(...) functionality to add another path with .pth processing.

----------
components: Library (Lib)
messages: 261958
nosy: tds333
priority: normal
severity: normal
status: open
title: Possible duplicate entries in sys.path if .pth files are used with zip's
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26587>
_______________________________________


More information about the New-bugs-announce mailing list