From fed3e427c061e9e94b4a10b8531bdba8b4d5bd6a Mon Sep 17 00:00:00 2001 From: akamat10 Date: Sun, 29 Sep 2024 14:31:38 -0400 Subject: [PATCH] Fix bug uncovered by unittests discovered on Windows --- pylint/lint/expand_modules.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pylint/lint/expand_modules.py b/pylint/lint/expand_modules.py index 5dbec6d79a..ebfa030c68 100644 --- a/pylint/lint/expand_modules.py +++ b/pylint/lint/expand_modules.py @@ -35,8 +35,11 @@ def discover_package_path( # Look for a source root that contains the module directory for source_root in source_roots: source_root = os.path.realpath(os.path.expanduser(source_root)) - if os.path.commonpath([source_root, dirname]) == source_root: - return [source_root] + try: + if os.path.commonpath([source_root, dirname]) == source_root: + return [source_root] + except ValueError: + continue if len(source_roots) != 0: return source_roots