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

Frame stack is not cleaned after execution is finished with return #81032

Closed
pablogsal opened this issue May 8, 2019 · 3 comments
Closed

Frame stack is not cleaned after execution is finished with return #81032

pablogsal opened this issue May 8, 2019 · 3 comments
Labels
3.8 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@pablogsal
Copy link
Member

BPO 36851
Nosy @vstinner, @DinoV, @pablogsal
PRs
  • bpo-36851: Clean the frame stack if the execution ends with a return and the stack is not empty #13191
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-05-09.15:52:19.181>
    created_at = <Date 2019-05-08.15:40:55.125>
    labels = ['interpreter-core', '3.8']
    title = 'Frame stack is not cleaned after execution is finished with return'
    updated_at = <Date 2019-05-13.15:31:20.580>
    user = 'https://github.com/pablogsal'

    bugs.python.org fields:

    activity = <Date 2019-05-13.15:31:20.580>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-09.15:52:19.181>
    closer = 'pablogsal'
    components = ['Interpreter Core']
    creation = <Date 2019-05-08.15:40:55.125>
    creator = 'pablogsal'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36851
    keywords = ['patch']
    message_count = 3.0
    messages = ['341891', '341986', '342341']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'dino.viehland', 'pablogsal']
    pr_nums = ['13191']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue36851'
    versions = ['Python 3.8']

    @pablogsal
    Copy link
    Member Author

    When evaluating a frame object, it is possible to exit the execution with some variables in the stack. The frame deallocator (frame_dealloc) only cleans the stack if f_stacktop is not NULL, but this only happens for generators and when trace functions are set. The eval loop does this cleanup already if an exception is being raised, but not if a RETURN_VALUE is set.

    In the PyconUS sprints, Dino and I have been working on this and we have decided that the cleanest approach is shared the same goto label with the path for exception handling, effectively cleaning up

    @pablogsal pablogsal added 3.8 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) labels May 8, 2019
    @pablogsal
    Copy link
    Member Author

    New changeset f00828a by Pablo Galindo in branch 'master':
    bpo-36851: Clean the frame stack if the execution ends with a return and the stack is not empty (GH-13191)
    f00828a

    @vstinner
    Copy link
    Member

    I marked bpo-36725 as a duplicate of this issue.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants