[Patches] [ python-Patches-1463867 ] Improved generator finalization

SourceForge.net noreply at sourceforge.net
Mon Apr 10 19:53:23 CEST 2006


Patches item #1463867, was opened at 2006-04-03 22:43
Message generated for change (Comment added) made by pje
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1463867&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.5
>Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Phillip J. Eby (pje)
Assigned to: Phillip J. Eby (pje)
Summary: Improved generator finalization

Initial Comment:
This patch improves generator finalization such that
simple generators (without active try/except/finally
blocks surrounding yield statements) can have their
cycles broken.

Please check to see if this patch improves the leaks
that prompted the request for changing this.  Thanks.

----------------------------------------------------------------------

>Comment By: Phillip J. Eby (pje)
Date: 2006-04-10 17:53

Message:
Logged In: YES 
user_id=56214

Checked in as of r45235, w/added comment to ceval.c.

If the test that's leaking doesn't leave a generator
suspended in a 'with', try/except, or try/finally block,
then a reference is probably being held somewhere that makes
it not garbage yet.  (Or perhaps it's being referenced by an
object w/a __del__ method?)  Let me know what you find out.


----------------------------------------------------------------------

Comment By: Thomas Wouters (twouters)
Date: 2006-04-09 15:02

Message:
Logged In: YES 
user_id=34209

The patch looks alright (although it could use some big
blinking comments in opcode.h and ceval.c, to make sure
PyGen_NeedsFinalizer is properly updated when new block
types are added.) The patch fixes the
test_generators_cycle.py leaker-test, but it does *not* fix
the cycles test_generators test. (Obviously after removing
the code that explicitly breaks the cycle in test_generators.)

I don't know why it doesn't clean up the test_generators
cycle. Maybe it's related to doctest, or the way doctests run.

----------------------------------------------------------------------

Comment By: Phillip J. Eby (pje)
Date: 2006-04-05 20:06

Message:
Logged In: YES 
user_id=56214

Argh.  Sorry.  Uploaded.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2006-04-05 19:25

Message:
Logged In: YES 
user_id=31435

There's no uploaded file!  You have to check the
checkbox labeled "Check to Upload & Attach File"
when you upload a file. In addition, even if you
*did* check this checkbox, a bug in SourceForge
prevents attaching a file when *creating* an issue.

Please try again.

(This is a SourceForge annoyance that we can do
nothing about. :-( )

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1463867&group_id=5470


More information about the Patches mailing list