github / github/codeql

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

Abierto
#8,714 5 comentarios 0 reacciones 0 asignados Ver en GitHub
false-positive Python
Lenguaje dominante
CodeQL
Estrellas
10.1k
Forks
2.1k
Merge medio
2 d 15 h
PR fusionados (30 d)
141

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.