From f4d88afdc60f04d1328823ce6d8e927a062feeed Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Thu, 30 Jun 2022 18:04:34 -0400 Subject: [PATCH 1/3] Add regression test for #5832 --- doc/whatsnew/2/2.15/index.rst | 5 +++++ tests/functional/n/no/no_member.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst index dc358063f4..ab00088c15 100644 --- a/doc/whatsnew/2/2.15/index.rst +++ b/doc/whatsnew/2/2.15/index.rst @@ -35,6 +35,11 @@ False positives fixed Closes #4951 +* Prevent false positives when accessing ``PurePath.parents`` by index (not slice) on Python 3.10+. + + Closes #5832 + + False negatives fixed ===================== diff --git a/tests/functional/n/no/no_member.py b/tests/functional/n/no/no_member.py index bff04a7b2f..1db70cde54 100644 --- a/tests/functional/n/no/no_member.py +++ b/tests/functional/n/no/no_member.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring, unused-argument, wrong-import-position, invalid-name - +from pathlib import Path # Regression test for https://github.com/PyCQA/pylint/issues/400 class TestListener: @@ -42,3 +42,7 @@ class Derived(Base): print(Derived.label) + + +# Regression test for https://github.com/PyCQA/pylint/issues/5832 +starter_path = Path(__file__).parents[3].resolve() From 3f3a11dc3a842cbc4691d4502991791c5dc73e81 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sun, 17 Jul 2022 17:26:36 -0400 Subject: [PATCH 2/3] add news --- doc/whatsnew/fragments/5832.false_positive | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 doc/whatsnew/fragments/5832.false_positive diff --git a/doc/whatsnew/fragments/5832.false_positive b/doc/whatsnew/fragments/5832.false_positive new file mode 100644 index 0000000000..9d042b0e90 --- /dev/null +++ b/doc/whatsnew/fragments/5832.false_positive @@ -0,0 +1,3 @@ +* Prevent false positives when accessing ``PurePath.parents`` by index (not slice) on Python 3.10+. + +Closes #5832 From b305a15694a84adf767c7c48121ca72853f0f1a6 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sun, 17 Jul 2022 17:33:43 -0400 Subject: [PATCH 3/3] remove * --- doc/whatsnew/fragments/5832.false_positive | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whatsnew/fragments/5832.false_positive b/doc/whatsnew/fragments/5832.false_positive index 9d042b0e90..40ae0fd1a2 100644 --- a/doc/whatsnew/fragments/5832.false_positive +++ b/doc/whatsnew/fragments/5832.false_positive @@ -1,3 +1,3 @@ -* Prevent false positives when accessing ``PurePath.parents`` by index (not slice) on Python 3.10+. +Prevent false positives when accessing ``PurePath.parents`` by index (not slice) on Python 3.10+. Closes #5832