LGTM.com - false positive `unhashable` alert indexing list with slice
Aperta
false-positive
Python
- Lingua principale
- CodeQL
- Stelle
- 10.1k
- Fork
- 2.1k
- Merge medio
- 2g 15h
- PR unite (30g)
- 141
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.