github / github/codeql

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

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

描述

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

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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