Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

Should setting the line number be allowed for PY_RESUME events? #113102

Open
markshannon opened this issue Dec 14, 2023 · 3 comments
Open

Should setting the line number be allowed for PY_RESUME events? #113102

markshannon opened this issue Dec 14, 2023 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@markshannon
Copy link
Member

markshannon commented Dec 14, 2023

Currently, setting the line number of a frame in a PY_RESUME event is allowed, but was accidentally broken in d27acd4

However, setting a line number is not allowed for PY_START events.
Historically both these events were treated as CALL events by sys.settrace, and setting the line number was not allowed.

I think, that for consistency, setting the line number of a frame in a PY_RESUME event should not be allowed.

@gaogaotiantian thoughts?

Linked PRs

@gaogaotiantian
Copy link
Member

I guess the question is - do we benefit from being able to jump in a PY_RESUME event.

For example, a dummy code:

def f():
    yield a; b = 3;
    yield b;
for i in f():
    print(i)

Being able to jump between yield a and b = 3 actually gives the user something - might not be that useful in this case. There might be actually useful cases in asyncio where PY_RESUME happens much frequently.

I don't think we ever documented this behavior, at least not in pdb. We say not all jumps are allowed, but never mention CALL event.

However, honestly, I don't think a lot of people are using this feature and I doubt anyone will even notice this. I'm totally fine with simply make the behavior consistent and disallow jump for PY_RESUME - especially if that makes the interpreter code simpler.

@hugovk
Copy link
Member

hugovk commented Mar 15, 2024

Triage: can this be closed or is there more to do?

@neonene
Copy link
Contributor

neonene commented Mar 15, 2024

Ah, this issue is still reconsidering the current situation restored by #114349.

Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
@encukou encukou added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

No branches or pull requests

5 participants