Skip to content

Commit 26fa5f9

Browse files
Fix sys.path pollution in parallel mode
1 parent 9e17a6d commit 26fa5f9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

doc/whatsnew/fragments/7246.bugfix

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix sys.path pollution in parallel mode.
2+
3+
Closes #7246

pylint/lint/pylinter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -651,12 +651,14 @@ def check(self, files_or_modules: Sequence[str] | str) -> None:
651651
self.get_ast, self._iterate_file_descrs(files_or_modules)
652652
)
653653
else:
654+
original_sys_path = sys.path[:]
654655
check_parallel(
655656
self,
656657
self.config.jobs,
657658
self._iterate_file_descrs(files_or_modules),
658-
files_or_modules,
659+
files_or_modules, # this argument patches sys.path
659660
)
661+
sys.path = original_sys_path
660662

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

0 commit comments

Comments
 (0)