Skip to content

Commit 15fae70

Browse files
SONARPY-1816 Ensure type inference doesn't lead to FPs in presence of isinstance checks for runtime types (#1803)
1 parent c8ad2b8 commit 15fae70

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

python-checks/src/test/resources/checks/nonCallableCalled.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,11 @@ class MyClass:
265265

266266
def foo():
267267
mc = MyClass()
268-
mc.x()
268+
mc.x()
269+
270+
def using_isinstance_with_runtime_type():
271+
my_non_callable = MyNonCallable()
272+
if isinstance(my_non_callable, whatever):
273+
my_non_callable() # Noncompliant
274+
...
275+
my_non_callable() # Noncompliant

0 commit comments

Comments
 (0)