github / github/codeql

LGTM.com - false positive

未關閉
#4,918 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
false-positive Python
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
141

描述

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

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。