github / github/codeql

[Python] False positive py/unreachable-statement with global variable

Abierto
#5,575 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug 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

**Description of the false positive**

A global variable is set (`t = None`) at the top of the file. Cleanup code checks `if t is not None`, and LGTM marks the code inside this branch unreachable. However, there is a method containing a `global t` statement, allowing it to reassign the global variable, which it does.

#1268 appears to be similar, but with the `nonlocal` statement in place of `global`.

**URL to the alert on the project page on LGTM.com**

https://lgtm.com/projects/g/h5py/h5py/snapshot/9722123a723cd6299d1f7470e0f789080ec18e23/files/examples/threading_example.py?sort=name&dir=ASC&mode=heatmap#xe2a68c5ef5581699:1

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.