github / github/codeql

LGTM.com - false positive `unreachable statement` for numpy boolean conversion

Aperta
#8,714 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub
false-positive Python
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

Consider this scenario:
```python
import numpy as np
cond = np.arange(25) < 5
try:
less_than_5 = bool(cond)
except ValueError:
less_than_5 = False
```
The `try` block is necessary, since array comparisons by definition raise `ValueError`s. This is certainly not an "unreachable statement". Am I missing something?

**URL to the alert on the project page on LGTM.com**
https://lgtm.com/projects/g/ntjess/s3a/snapshot/8565aa0f07a734d5b92e29b61cd3e6169e67f704/files/s3a/models/tablemodel.py?sort=name&dir=ASC&mode=heatmap#L77

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.