github / github/codeql

LGTM.com - false positive `unhashable` alert indexing list with slice

Đang mở
#8,711 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ả

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

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.