github / github/codeql

LGTM.com - false positive

Đang mở
#4,918 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
false-positive Python
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.