-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Invalid autofix for RSE102 #8228
Comments
Ahh yeah, I believe this is similar to #5416 -- we just can't detect this reliably in all cases. |
We should mark this as an unsafe edit, so that users have to opt in to apply it. |
I agree. |
No worries! Thanks for reporting, since we did have at least one change to make here. |
## Summary This rule is now unsafe if we can't verify that the `obj` in `raise obj()` is a class or builtin. (If we verify that it's a function, we don't raise at all, as before.) See the documentation change for motivation behind the unsafe edit. Closes #8228.
In the following simple example
test_ruff.py
:When run:
ruff reports the error RSE102 and suggests fixing it, producing:
Which changes the behaviour when run from the original code:
The text was updated successfully, but these errors were encountered: