Fix type inference of subscripted list slice#7689
Conversation
|
I am taking liberty and merge this change without code review because:
If there are any comments/improvements can be implemented in another PR... |
|
I don't think any of the test failures are particularly relevant here (they all affect every other branch right now and I think aren't issues that we can fix). I don't fully understand ones on the Python development branch; I've reported the pypu one to pypy. |
|
Yeah I ser. Unfortunately it blocks my automerge ... |
|
One extra check I'd add here: In this case the return type should be a single element (or just I've never seen this used in real code so I think the main thing is that it doesn't infer something incorrect like a |
I think already cython in master contains error your code produces >>> d = { slice(1, 5): "some_value" }
>>> d[1:5]
'some_value' |
|
We could add the following to the start of the if is_slice and base_type.is_pyanydict_type:
is_slice = FalseFor a dict, a slice lookup is never special. |
The fix is totally unrelated to this PR so I fixed it in separate PR: #7702 |
Fixes #7688