github / github/codeql

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

Ouverte
#18,725 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
question
Langage dominant
CodeQL
Étoiles
10.1k
Forks
2.1k
Merge moyen
2 j 15 h
PR mergées (30 j)
141

Description

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?

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
devtools
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.