diff options
author | Louis Sautier <sautier.louis@gmail.com> | 2021-02-28 17:50:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-28 17:50:05 +0100 |
commit | cc8d9185d1b0ca79ed49efd0ee2d3cae5b1cacbb (patch) | |
tree | f7b9eea94aacd3a80bbcaaf1837ea75c3d77fea4 /pylint | |
parent | 41d2349c7b84714539a9979b5344294029c984ab (diff) | |
download | pylint-git-cc8d9185d1b0ca79ed49efd0ee2d3cae5b1cacbb.tar.gz |
Properly strip dangerous sys.path entries (not just the first one) (#4153)
51c646bf70a6e0a86492bfd2ddd1885671d64d67 only stripped the first bad
sys.path entry, causing problems when PYTHONPATH starts or ends with a
colon.
Closes: https://github.com/PyCQA/pylint/issues/3636
Diffstat (limited to 'pylint')
-rw-r--r-- | pylint/__main__.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/pylint/__main__.py b/pylint/__main__.py index 767746a2a..89bd19924 100644 --- a/pylint/__main__.py +++ b/pylint/__main__.py @@ -13,7 +13,6 @@ import pylint # inadvertently import user code from modules having the same name as # stdlib or pylint's own modules. # CPython issue: https://bugs.python.org/issue33053 -if sys.path[0] == "" or sys.path[0] == os.getcwd(): - sys.path.pop(0) +sys.path = [p for p in sys.path if p not in ("", os.getcwd())] pylint.run_pylint() |