Skip to content

fix(checkexpr): use Any for omitted slice indices when strict_optional is False - #21782

Open
amir-rezaei wants to merge 1 commit into
python:masterfrom
amir-rezaei:fix/visit-slice-expr-strict-optional-false-none-type
Open

fix(checkexpr): use Any for omitted slice indices when strict_optional is False#21782
amir-rezaei wants to merge 1 commit into
python:masterfrom
amir-rezaei:fix/visit-slice-expr-strict-optional-false-none-type

Conversation

@amir-rezaei

Copy link
Copy Markdown

Description

This PR resolves issue #21777 by using AnyType for omitted slice indices when strict_optional = False in visit_slice_expr() in mypy/checkexpr.py.

Details

  • Prevents false-positive Invalid index type "slice[int, None, None]" for "str" errors when strict_optional = False is configured.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants