github / github/codeql

LGTM.com - false positive: 0 != None

Open
#2,465 0 comments 0 reactions 0 assignees View on GitHub
false-positive Python
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

**Platform: Python**

**Description of the false positive**

Apparently
```python
if n == 0:
print("a")
elif not n:
print("b")
else:
print("c")
```

Shows the elif as dead code. However if n is `None` it will get triggered.

**URL to the alert on the project page on LGTM.com**: https://lgtm.com/projects/g/secdev/scapy/snapshot/4d06eb2812a98a1001478bf06e033fbbb2afbef7/files/scapy/volatile.py?sort=name&dir=ASC&mode=heatmap#xf144c20a181fcce0: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.