From 1deaffababe77e8a025e3b2e5d564d4feb8d987f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2024 22:04:58 +0000 Subject: [PATCH] Fix to maintain order of package paths (#9887) (#9897) (cherry picked from commit 8314743abec3106c21c364cfc2976713af245325) Co-authored-by: Akhil Kamat --- doc/whatsnew/fragments/9883.bugfix | 3 +++ pylint/lint/pylinter.py | 10 ++++++---- tests/functional/r/recursion/recursion_error_3152.py | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 doc/whatsnew/fragments/9883.bugfix 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 diff --git a/tests/functional/r/recursion/recursion_error_3152.py b/tests/functional/r/recursion/recursion_error_3152.py index 97ec190e8f..2d7de55079 100644 --- a/tests/functional/r/recursion/recursion_error_3152.py +++ b/tests/functional/r/recursion/recursion_error_3152.py @@ -2,6 +2,6 @@ import setuptools -# pylint: disable=missing-docstring,too-few-public-methods +# pylint: disable=missing-docstring,too-few-public-methods,abstract-method class Custom(setuptools.Command): pass