classification
Title: Test for closing delegating generator with cleared frame (Issue17669)
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, isoschiz, pconnell, python-dev
Priority: normal Keywords: patch

Created on 2013-07-27 00:01 by pconnell, last changed 2013-07-27 21:07 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
gen_close_with_cleared_frame.diff pconnell, 2013-07-27 00:01 review
gen_close_with_cleared_frame.diff pconnell, 2013-07-27 20:37 review
Messages (4)
msg193765 - (view) Author: Phil Connell (pconnell) * Date: 2013-07-27 00:01
This is a testcase for issue17669 - it passes against the latest default (and hits the same segfault under 3.3.0).


I came up with this while tracking down a thorny generator finalisation crash that turned out to be a variant on 17669.

The root cause was gen_close being called on a generator that's delegating to another, and whose frame has already had frame_clear called (so f_stacktop is NULL).

It's reproduced by creating a reference cycle that's broken by clearing the delegating generator's frame.
msg193775 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-07-27 06:07
Thanks! It looks good except I think you could use the support.disable_gc() context manager.
msg193794 - (view) Author: Phil Connell (pconnell) * Date: 2013-07-27 20:37
Good suggestion, updated patch attached.
msg193798 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-07-27 21:07
New changeset 516303f32bad by Benjamin Peterson in branch '3.3':
add a test for issue #17669 (closes #18565)
http://hg.python.org/cpython/rev/516303f32bad

New changeset f90e7540dcba by Benjamin Peterson in branch 'default':
merge 3.3 (#18565)
http://hg.python.org/cpython/rev/f90e7540dcba
History
Date User Action Args
2013-07-27 21:07:38python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg193798

resolution: fixed
stage: resolved
2013-07-27 20:37:21pconnellsetfiles: + gen_close_with_cleared_frame.diff

messages: + msg193794
2013-07-27 06:07:53benjamin.petersonsetmessages: + msg193775
2013-07-27 00:01:47pconnellcreate