This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Frame stack is not cleaned after execution is finished with return
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.8
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: dino.viehland, pablogsal, vstinner
Priority: normal Keywords: patch

Created on 2019-05-08 15:40 by pablogsal, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13191 merged pablogsal, 2019-05-08 15:43
Messages (3)
msg341891 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2019-05-08 15:40
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
msg341986 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2019-05-09 15:52
New changeset f00828a742d2e88c910bdfd00f08fcd998554ba5 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)
msg342341 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-13 15:31
I marked bpo-36725 as a duplicate of this issue.
Date User Action Args
2022-04-11 14:59:14adminsetgithub: 81032
2019-05-13 15:31:20vstinnersetnosy: + vstinner
messages: + msg342341
2019-05-13 15:31:06vstinnerlinkissue36725 superseder
2019-05-09 15:52:19pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-05-09 15:52:06pablogsalsetmessages: + msg341986
2019-05-08 15:43:09pablogsalsetkeywords: + patch
stage: patch review
pull_requests: + pull_request13103
2019-05-08 15:40:55pablogsalcreate