From cc8d9185d1b0ca79ed49efd0ee2d3cae5b1cacbb Mon Sep 17 00:00:00 2001 From: Louis Sautier Date: Sun, 28 Feb 2021 17:50:05 +0100 Subject: 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 --- pylint/__main__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'pylint') 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() -- cgit v1.2.1