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 correctly pass positional-only arguments correctly #567

Closed
lieryan opened this issue Dec 2, 2022 · 0 comments
Closed
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 defines a positional-only argument:

def foo(a, /, arg):

Currently, rope doesn't handle variable scope around positional-only argument correctly.

To Reproduce

Steps to reproduce the behavior:

  1. Code before refactoring:
def foo(a, /, arg):
    print(a)
  1. Describe the refactoring you want to do: Extract refactoring

  2. Expected code after refactoring:

def foo(a, /, arg):
    extracted_method(a)

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

def extracted_method():
    print(a)

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 changed the title Extract method passes incorrect keyword-only arguments around positional-only parameter Extract method doesn't correctly pass keyword-only arguments around positional-only parameter Dec 2, 2022
@lieryan lieryan changed the title Extract method doesn't correctly pass keyword-only arguments around positional-only parameter Extract method doesn't correctly pass positional-only arguments correctly 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

No branches or pull requests

1 participant