You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't think so, this is mypy's general slicing check, not a specific __getitem__ override. Looks like the bug is in visit_slice_expr in checkexpr.py. The error message says that int or None is accepted, but the code only accepts int.
Activity
gvanrossum commentedon May 24, 2017
Probably a typeshed issue.
JelleZijlstra commentedon May 24, 2017
I don't think so, this is mypy's general slicing check, not a specific
__getitem__override. Looks like the bug is invisit_slice_exprin checkexpr.py. The error message says that int or None is accepted, but the code only accepts int.chrish42 commentedon May 24, 2017
Furthermore, None as a slice index works in at least some cases:
So, at least for some cases, the code in
visit_slice_exprshould be more lenient and accept None as a slice index.gvanrossum commentedon May 24, 2017
OK, I thought mypy usually eventually defer to a dunder method, but if it doesn't in this case it's a mypy bug, perhaps related to strict optional.
Fix None slice bounds with strict-optional (#3445)