github / github/codeql

LGTM.com - false positive : Values compared using 'is' when equivalence is not the same as identity. Use '==' instead.

Ouverte
#5,617 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
acknowledged false-positive not security Python
Langage dominant
CodeQL
Étoiles
10.1k
Forks
2.1k
Merge moyen
2 j 15 h
PR mergées (30 j)
141

Description

**Description of the false positive**

"Values compared using 'is' when equivalence is not the same as identity. Use '==' instead.".
I know equivalence is not the same as identity here, I want to test for identity.
I may be misunderstanding the error, but I don't get why lgtm suggest that I use `==` instead of `is` here.
Using a sentinel object as a default value is a [common Python pattern](https://python-patterns.guide/python/sentinel-object/#sentinel-objects).

**URL to the alert on the project page on LGTM.com**
https://lgtm.com/projects/g/facebookresearch/hydra/snapshot/7b06f68ba1c8781906159486ab2a1df2b564dad0/files/hydra/initialize.py?sort=name&dir=ASC&mode=heatmap#xae22158192d12f0b:1

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

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