Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UP036 (outdated-version-block) does not work with slicing #8095

Closed
tdulcet opened this issue Oct 20, 2023 · 0 comments · Fixed by #8112
Closed

UP036 (outdated-version-block) does not work with slicing #8095

tdulcet opened this issue Oct 20, 2023 · 0 comments · Fixed by #8112
Assignees
Labels
bug Something isn't working

Comments

@tdulcet
Copy link

tdulcet commented Oct 20, 2023

import sys

if sys.version_info[:2] < (3, 7):
    print('oh no')

This if block should be removed with --fix, but nothing changes. The Ruff documentation even suggests using this slice syntax here, so this should work as expected. (Maybe a new linter rule could be added to remove this unnecessary slice syntax as well.)

ruff --target-version py37 --select UP036 --isolated test.py
ruff 0.1.1

Originally posted by @tdulcet in #7902 (comment)

@charliermarsh charliermarsh added the bug Something isn't working label Oct 20, 2023
@charliermarsh charliermarsh self-assigned this Oct 21, 2023
charliermarsh added a commit that referenced this issue Oct 21, 2023
## Summary

Given `sys.version_info[:2] >= (3,0)`, we should treat this equivalently
to `sys.version_info >= (3,0)`.

Closes #8095.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants