github / github/codeql

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

Aperta
#5,617 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
acknowledged false-positive not security Python
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

**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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.