diff --git a/doc/whatsnew/fragments/9883.bugfix b/doc/whatsnew/fragments/9883.bugfix new file mode 100644 index 0000000000..51a1a935c0 --- /dev/null +++ b/doc/whatsnew/fragments/9883.bugfix @@ -0,0 +1,3 @@ +Fix to address indeterminacy of error message in case a module name is same as another in a separate namespace. + +Refs #9883 diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index eff15cc444..dce95e0036 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -666,10 +666,12 @@ def check(self, files_or_modules: Sequence[str]) -> None: ) extra_packages_paths = list( - { - discover_package_path(file_or_module, self.config.source_roots) - for file_or_module in files_or_modules - } + dict.fromkeys( + [ + discover_package_path(file_or_module, self.config.source_roots) + for file_or_module in files_or_modules + ] + ).keys() ) # TODO: Move the parallel invocation into step 3 of the checking process