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

Incorrect context definition for comment following nested function #2038

Open
oliversen opened this issue Nov 18, 2024 · 1 comment
Open

Comments

@oliversen
Copy link

Code for reproduction:

from jedi import Script

code = """
def foo():
    def bar():
        ...

    # Comment in foo
"""

script = Script(code)
context = script.get_context(6, 6)
print(context.name)  # `bar` when it should be `foo`

Jedi v0.19.2
Python v3.11

@davidhalter
Copy link
Owner

While #2037 is definitely a bug, this one is a bit debatable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants