github / github/codeql

LGTM.com - false positive

Ouverte
#4,918 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
false-positive Python
Langage dominant
CodeQL
Étoiles
10.1k
Forks
2.1k
Merge moyen
2 j 15 h
PR mergées (30 j)
141

Description

**Description of the false positive**

LGTM.com alerted about "illegal raise", with the description "Illegal class 'NoneType' raised; will result in a TypeError being raised instead."

Refer to the [screenshot on Twitter](https://pbs.twimg.com/media/Eq8c3vTUwAEqlIU?format=png).

Code replicated:

```python
if self._thread_exception is not None: # pragma: nowsl
# See comment about WSL1.0 in the _run() method
raise self._thread_exception
```

As you can see, it is simply _impossible_ for `self._thread_exception` to be `None` when it's raised; the `if` statement on the first line guarantees that.

This occurred **twice** in the same file; see URLs below:

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

https://lgtm.com/projects/g/aio-libs/aiosmtpd/snapshot/1dc00d77a8767369d079567e4240b757a3e96d7b/files/aiosmtpd/controller.py?sort=name&dir=ASC&mode=heatmap#x5de8abb8d304cf9:1

and

https://lgtm.com/projects/g/aio-libs/aiosmtpd/snapshot/1dc00d77a8767369d079567e4240b757a3e96d7b/files/aiosmtpd/controller.py#x95bc8f7524427423:1

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.