Skip to content

Conversation

brianschubert
Copy link
Member

Fixes #18062

I plan to follow up with another PR that adds a better error messages for slice expressions with step=0 when indexing standard containers that disallow that.

Copy link
Contributor

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

@brianschubert
Copy link
Member Author

Python 3.8 failure on Windows looks like a flake.

Comment on lines +1443 to +1444
# TODO: emit better error when 0 is used for step
()[::0] # E: Ambiguous slice of a variadic tuple
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If #18065 gets merged, this test will change:

Suggested change
# TODO: emit better error when 0 is used for step
()[::0] # E: Ambiguous slice of a variadic tuple
()[::0] # E: Slice step cannot be 0

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, makes sense to do the simplest fix for a crash first

@hauntsaninja hauntsaninja merged commit 654ae20 into python:master Oct 29, 2024
18 of 19 checks passed
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.

Crash when checking slice expression with 0 used for the step

2 participants