Skip to content

Fix sys.path pollution in parallel mode #7247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/7246.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix sys.path pollution in parallel mode.

Closes #7246
4 changes: 3 additions & 1 deletion pylint/lint/pylinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,12 +651,14 @@ def check(self, files_or_modules: Sequence[str] | str) -> None:
self.get_ast, self._iterate_file_descrs(files_or_modules)
)
else:
original_sys_path = sys.path[:]
check_parallel(
self,
self.config.jobs,
self._iterate_file_descrs(files_or_modules),
files_or_modules,
files_or_modules, # this argument patches sys.path
)
sys.path = original_sys_path

def check_single_file(self, name: str, filepath: str, modname: str) -> None:
warnings.warn(
Expand Down