Skip to content

Commit e1a478d

Browse files
Fix the other use case of qname failing
1 parent 9619618 commit e1a478d

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

pylint/checkers/refactoring/refactoring_checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2000,7 +2000,7 @@ def _is_function_def_never_returning(self, node: nodes.FunctionDef) -> bool:
20002000
)
20012001
try:
20022002
return node.qname() in self._never_returning_functions
2003-
except TypeError:
2003+
except (TypeError, AttributeError):
20042004
return False
20052005

20062006
def _check_return_at_the_end(self, node: nodes.FunctionDef) -> None:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
"""Regression tests for inferred.qname missing"""
22

3+
# pylint: disable=missing-docstring,too-few-public-methods,disallowed-name
4+
35
x = slice(42)
46
x() # [not-callable]
7+
8+
9+
class Foo:
10+
def __init__(self, foo=slice(42)):
11+
self.foo = foo
12+
13+
14+
def bar():
15+
i = Foo()
16+
i.foo()
17+
return 100
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
not-callable:4:0:4:3::x is not callable:UNDEFINED
1+
not-callable:6:0:6:3::x is not callable:UNDEFINED

0 commit comments

Comments
 (0)