Skip to content

Conversation

@TaKO8Ki
Copy link
Contributor

@TaKO8Ki TaKO8Ki commented Sep 10, 2025

Summary

Fixes #19842

Prevent infinite loop with I002 and UP026

  • Implement isort-aware handling for UP026 (deprecated mock import):
  • Add CLI integration tests in crates/ruff/tests/lint.rs:

Test Plan

I have added two integration tests pyupgrade_up026_respects_isort_required_import_fix and pyupgrade_up026_respects_isort_required_import_from_fix in crates/ruff/tests/lint.rs.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 10, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

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

Looks good, just a few nits - thank you!

Copy link
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

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

Thank you!

@dylwil3 dylwil3 added the bug Something isn't working label Sep 12, 2025
@dylwil3 dylwil3 changed the title [pyupgrade] Prevent infinite loop with I002 and UP026 [pyupgrade] Prevent infinite loop with I002 and UP026 Sep 12, 2025
@dylwil3 dylwil3 merged commit 151ba49 into astral-sh:main Sep 12, 2025
35 checks passed
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 this pull request may close these issues.

[Infinite loop] I002 and UP026

2 participants