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

Extract method doesn't pass keyword-only arguments to the new method #566

Closed
lieryan opened this issue Dec 2, 2022 · 0 comments · Fixed by #597
Closed

Extract method doesn't pass keyword-only arguments to the new method #566

lieryan opened this issue Dec 2, 2022 · 0 comments · Fixed by #597
Labels
bug Unexpected or incorrect user-visible behavior
Milestone

Comments

@lieryan
Copy link
Member

lieryan commented Dec 2, 2022

Describe the bug

The * syntax in parameter list defines a keyword-only argument:

def foo(a, *, arg):

Extract variable scope is incorrect when handling keywords-only arguments.

To Reproduce
Steps to reproduce the behavior:

  1. Code before refactoring:
def func(a, *, arg):
    print(arg)
  1. Describe the refactoring you want to do: extract refactoring

  2. Expected code after refactoring:

def func(a, *, arg):
    extracted_method(arg)

def extracted_method(arg):
    print(arg)
  1. Describe the error or unexpected result that you are getting
def func(a, *, arg):
    extracted_method()

def extracted_method():
    print(arg)

Editor information (please complete the following information):

  • Project Python version: 3.10
  • Rope Python version: 3.10
  • Rope version: 1.5.1
@lieryan lieryan added the bug Unexpected or incorrect user-visible behavior label Dec 2, 2022
@lieryan lieryan added this to the 1.7.0 milestone Dec 2, 2022
@lieryan lieryan modified the milestones: 1.7.0, 1.6.0 Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected or incorrect user-visible behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant