github / github/codeql

LGTM.com - false positive

Offen
#4,918 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
false-positive Python
Vorherrschende Sprache
CodeQL
Sterne
10.1k
Forks
2.1k
Ø Merge
2 T. 15 Std.
Gemergte PRs (30 T.)
141

Beschreibung

**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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.