github / github/codeql

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

Aberta
#8,714 5 comentários 0 reações 0 responsáveis Ver no GitHub
false-positive Python
Linguagem predominante
CodeQL
Estrelas
10.1k
Forks
2.1k
Merge médio
2d 15h
PRs com merge (30d)
141

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.