Skip to content

Validate LocalToField offsets during construction - #944

Closed
Narek-Khachikyan wants to merge 1 commit into
python-rope:masterfrom
Narek-Khachikyan:fix-local-to-field-validation
Closed

Narek-Khachikyan wants to merge 1 commit into
python-rope:masterfrom
Narek-Khachikyan:fix-local-to-field-validation

Conversation

@Narek-Khachikyan

Copy link
Copy Markdown

Description

Editor integrations construct LocalToField to decide whether to offer the refactoring. Invalid targets currently pass construction and fail only when get_changes() runs.

Validate eligibility in the constructor and reuse the resolved name for conversion. Reject unresolved names and builtins with RefactoringError before reading their definition locations.

Fixes #927.

The constructor tests have 7 failures and 3 passes before the fix, then all 10 pass on Python 3.11, 3.13, and 3.14. The full suite passes on Python 3.13 with 2,173 passed, 7 skipped, and 5 expected failures. Local full-suite runs on Python 3.11 and 3.14 encounter interpreter-related fixture errors. Pre-commit and the package build pass.

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have updated CHANGELOG.md

@Narek-Khachikyan Narek-Khachikyan closed this by deleting the head repository Nov 9, 2026
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.

LocalToField doesn't validate the offset until get_changes()

1 participant