File tree 3 files changed +19
-1
lines changed
tests/functional/ext/private_import
3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ Release date: TBA
22
22
23
23
Closes #6810
24
24
25
+ * Fix a crash in the optional ``pylint.extensions.private_import `` extension.
26
+
27
+ Closes #6624
28
+
25
29
26
30
What's New in Pylint 2.14.0?
27
31
----------------------------
Original file line number Diff line number Diff line change @@ -234,7 +234,8 @@ def _assignments_call_private_name(
234
234
while isinstance (current_attribute , (nodes .Attribute , nodes .Call )):
235
235
if isinstance (current_attribute , nodes .Call ):
236
236
current_attribute = current_attribute .func
237
- current_attribute = current_attribute .expr
237
+ if not isinstance (current_attribute , nodes .Name ):
238
+ current_attribute = current_attribute .expr
238
239
if (
239
240
isinstance (current_attribute , nodes .Name )
240
241
and current_attribute .name == private_name
Original file line number Diff line number Diff line change @@ -119,3 +119,16 @@ def c2_func() -> _TypeContainerC.C:
119
119
import _private_module_unreachable # [import-private-name]
120
120
my_var8 : _private_module_unreachable .Thing8
121
121
_private_module_unreachable .Thing8 ()
122
+
123
+
124
+ # pylint: disable=too-few-public-methods
125
+ class Regression6624 :
126
+ """Ensure that an import statement precedes this case."""
127
+ def get_example (self ):
128
+ example : Example = Example ().save ()
129
+ return example
130
+
131
+
132
+ class Example :
133
+ def save (self ):
134
+ return self
You can’t perform that action at this time.
0 commit comments