LGTM.com - false positive `unhashable` alert indexing list with slice
未關閉
false-positive
Python
- 主要語言
- CodeQL
- 星號
- 10.1k
- 分支
- 2.1k
- 平均合併
- 2 天 15 小時
- 30 天內合併 PR
- 141
描述
Consider the following example (reduced version of the actual alert):
```python
def access_one_or_all(one=False):
if one:
accessor = 0
else:
accessor = slice(None)
mylist = [1,2,3]
return mylist[accessor]
```
This is valid python code, but LGTM gives me the following alert:
`This instance of slice is unhashable.`
**URL to the alert on the project page on LGTM.com**
https://lgtm.com/projects/g/ntjess/s3a/snapshot/8565aa0f07a734d5b92e29b61cd3e6169e67f704/files/s3a/compio/helpers.py#L61
貢獻指南
評估
這個 Issue 還沒有評估資料。