github / github/codeql

False Negative - Python `abc.ABC` makes method's `getACall` unavailable

未關閉
#18,725 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
question
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
141

描述

If we have this Python code:
```python
class MyClass():
def method(self):
print("xxx")
def wrapper(self):
self.method()

mc = MyClass()
mc.method()
```
and this query:
```codeql
import python

from PythonFunctionValue method
select method.getACall()
```
It's OK that `self.method()` and `mc.method()` will be marked as positive.

However, those will be false negative as long as the class `MyClass` inherits `abc.ABC`. It looks like:
```python
from abc import ABC

class MyClass(ABC):
def method(self):
print("xxx")
def wrapper(self):
self.method()

mc = MyClass()
mc.method()
```

Why does the `abc.ABC` make the result wrong?

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。