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

os-error-alias does not include os.error #7580

Closed
Avasam opened this issue Sep 21, 2023 · 0 comments · Fixed by #7582
Closed

os-error-alias does not include os.error #7580

Avasam opened this issue Sep 21, 2023 · 0 comments · Fixed by #7582
Assignees
Labels
bug Something isn't working

Comments

@Avasam
Copy link

Avasam commented Sep 21, 2023

os.error is an alias for OSError, but is not standardized as part of https://docs.astral.sh/ruff/rules/os-error-alias/

>>> import os; OSError is os.error
True
import os

try:
    pass
except (WindowsError, os.error):
    pass

becomes:

import os

try:
    pass
except (OSError, os.error):
    pass

expected:

import os  # This import is now unused and can be removed

try:
    pass
except OSError:
    pass

This would be a deviation from pyupgrade, I have opened the same request in parallel: asottile/pyupgrade#892
Edit: This was just added in asottile/pyupgrade#893

@Avasam Avasam changed the title os-error-aliases does not include os.error os-error-alias does not include os.error Sep 21, 2023
@charliermarsh charliermarsh added the bug Something isn't working label Sep 21, 2023
@charliermarsh charliermarsh self-assigned this Sep 21, 2023
charliermarsh added a commit that referenced this issue Sep 21, 2023
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