Skip to content

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

@lieryan

Description

@lieryan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected or incorrect user-visible behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions