Skip to content

Import default dependencies when inlining across modules - #942

Closed
Narek-Khachikyan wants to merge 1 commit into
python-rope:masterfrom
Narek-Khachikyan:fix-inline-default-imports-743
Closed

Narek-Khachikyan wants to merge 1 commit into
python-rope:masterfrom
Narek-Khachikyan:fix-inline-default-imports-743

Conversation

@Narek-Khachikyan

Copy link
Copy Markdown

Description

Inlining a method into another module could insert a default such as sys.maxsize without importing sys, causing a NameError. Collect and rewrite imports from parameter defaults as well as the method body. Temporary assignments preserve multiline and string defaults.

Fixes #743

The executable regression failed with NameError before the fix and now returns the expected result. Validation: 105 inline tests passed; the full suite had 2,172 passed, 7 skipped, and 5 expected failures. Black and isort checks passed.

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.

Applying the Inline Method refactoring does not add the required import.

1 participant