github / github/codeql

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

Open
#5,617 1 comment 0 reactions 0 assignees View on GitHub
acknowledged false-positive not security Python
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.