blob: 999f0f4359be273ef7e4fb3ff590883a45b4e6e6 [file] [log] [blame]
From 7e53ba97410d1e5c59d142c8fdeba578f555ebaf Mon Sep 17 00:00:00 2001
From: Brian Ryner <bryner@google.com>
Date: Thu, 5 Aug 2021 19:22:35 +0000
Subject: [PATCH] Changes to improve multiprocessing PRESUBMIT support in
Windows
* fix bug in pylint which caused it to manipulate sys.path before
spawning its subprocesses, which caused multiprocessing to fail
on windows (DIFF1).
* Note: This may carry a slight semantic change. Before, pylint would
add all .py files' directories to sys.path while checking any of
them. Now in parallel mode, pylint will only add the path of the
single file to sys.path. This behavior actually mirrors Python's
own behavior, so the check should be more-correct than before (and
should cut down on pylint import scanning time with very large
sys.path's).
* If someone encounters an issue with this, please note that the
GetPylint check also includes an extra_paths_list which is
expressly for this purpose.
R=dpranke@chromium.org, kbr@chromium.org, maruel@chromium.org
BUG=501012
Review URL: https://codereview.chromium.org/1208743002
---
pylint/lint.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pylint/lint.py b/pylint/lint.py
index c5f9328f..1d940654 100644
--- a/pylint/lint.py
+++ b/pylint/lint.py
@@ -733,7 +733,8 @@ class PyLinter(config.OptionsManagerMixIn,
files_or_modules = (files_or_modules,)
if self.config.jobs == 1:
- self._do_check(files_or_modules)
+ with fix_import_path(files_or_modules):
+ self._do_check(files_or_modules)
else:
with _patch_sysmodules():
self._parallel_check(files_or_modules)
--
2.32.0.605.g8dce9f2422-goog