github / github/codeql

[Python] [LGTM.com] False-positive: Unreachable statement: #2206 sequel

Đang mở
#2,351 3 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**

Same as #2206. Except the reproducer contains several subsequent `suppress()`es:
```python
import contextlib

def some_func():
with contextlib.suppress(KeyError):
return dict()['a_key']

with contextlib.suppress(KeyError): # LGTM complains that it's unreachable
return dict()['b_key']

with contextlib.suppress(KeyError):
return dict()['c_key']

return 'fallback'
```

So I guess #2078 needs more test cases maybe...

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

https://lgtm.com/projects/g/cherrypy/cheroot/snapshot/0c678bab518ca17151540b7d744faca49b941763/files/cheroot/ssl/builtin.py#x46e331ef60ba4bf1: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.