github / github/codeql

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

Aberta
#18,725 3 comentários 0 reações 0 responsáveis Ver no GitHub
question
Linguagem predominante
CodeQL
Estrelas
10.1k
Forks
2.1k
Merge médio
2d 15h
PRs com merge (30d)
141

Descrição

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?

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Reproduce the two Python examples and run the shown CodeQL query importing PythonFunctionValue. Compare whether getACall() reports method calls with and without abc.ABC inheritance, then inspect the Python library behavior responsible for the difference. Done means the query consistently recognizes the calls in both examples or the issue documents the supported limitation.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
devtools
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.