[issue24534] disable executing code in .pth files

Tim Smith report at bugs.python.org
Mon Jun 29 21:57:36 CEST 2015


Tim Smith added the comment:

In Homebrew we occasionally use .pth files to call site.addsitedir. This is useful when we want to add a directory to sys.path that contains .pth files that also need to be processed (for example, when adding a directory to sys.path that contains namespace packages). It would be helpful to retain a mechanism for adding site dirs from a .pth file.

Homebrew also writes temporary probe .pths containing "import site; site.homebrew_was_here = True" in order to check whether .pth files are processed in a particular path, though we could equivalently write a temporary path to a .pth file and verify that it ends up in sys.path.

Finally, Homebrew asks users to write .pth files with imports in some places where we could use usercustomize instead.

----------
nosy: +tdsmith

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


More information about the Python-bugs-list mailing list