[ python-Bugs-1464571 ] Changes to generator object's gi_frame attr

SourceForge.net noreply at sourceforge.net
Thu Apr 13 15:40:00 CEST 2006


Bugs item #1464571, was opened at 2006-04-04 19:44
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1464571&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: Python Interpreter Core
Group: Python 2.5
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Collin Winter (collinwinter)
Assigned to: A.M. Kuchling (akuchling)
Summary: Changes to generator object's gi_frame attr

Initial Comment:
In 2.4 (as late as 2.4.3), a generator's gi_frame
attribute was always a frame object. In the current SVN
revision (43631), gi_frame is sometimes None, a change
I can't find any documentation of in the What's New for
2.5 section.

If this was intentional, it should be documented -- I
can't be the only one with packages that used this
behaviour. If it was unintentional, I'd appreciate it
if this could be fixed before 2.5 goes out.

I don't have a (simple) repro case at this time, but
I'll post one as soon as I can simplify the current one
down.

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

>Comment By: A.M. Kuchling (akuchling)
Date: 2006-04-13 09:40

Message:
Logged In: YES 
user_id=11375

No, it's correct; I verified it with a small test program. 
Whether PJE's code uses Py_None or NULL, you still get a
None in your Python code.


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

Comment By: Žiga Seilnacht (zseil)
Date: 2006-04-13 09:30

Message:
Logged In: YES 
user_id=1326842

I don't think that your change is correct anymore;
Philip J. Eby has changed the behaviour again in
revision 45316. The log for his checkin says:

Don't set gi_frame to Py_None, use NULL instead,
eliminating some insane pointer dereferences.

See:
http://mail.python.org/pipermail/python-dev/2006-April/063647.html
http://mail.python.org/pipermail/python-checkins/2006-April/051180.html

for more details.


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

Comment By: A.M. Kuchling (akuchling)
Date: 2006-04-13 08:50

Message:
Logged In: YES 
user_id=11375

I've added a mention of this page to the "What's New";
thanks for the suggestion!


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

Comment By: Žiga Seilnacht (zseil)
Date: 2006-04-12 19:35

Message:
Logged In: YES 
user_id=1326842

This was changed again in revision 45316.
The current comment in genobject.h says:
Note: gi_frame can be NULL if the generator is "finished"

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

Comment By: Collin Winter (collinwinter)
Date: 2006-04-04 19:53

Message:
Logged In: YES 
user_id=1344176

*stops, thinks, comes up with repro case in 30 seconds*

This does indeed seem to be intentional (introduced in
r39239 during the implementation of PEP 342). To trigger
this, all you have to do is run a generator til exhaustion
(ie, StopIteration); at this point, the frame is decref'd
and gi_frame is set to None.

I'd appreciate it if this could be added to the "Porting to
2.5" section of What's New.

Sorry for the confusion.

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

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


More information about the Python-bugs-list mailing list