[Patches] [ python-Patches-486743 ] remove bad INCREF, propagate exception

noreply@sourceforge.net noreply@sourceforge.net
Wed, 28 Nov 2001 16:33:58 -0800


Patches item #486743, was opened at 2001-11-28 15:11
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=486743&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Zooko Ozoko (zooko)
Assigned to: Nobody/Anonymous (nobody)
Summary: remove bad INCREF, propagate exception

Initial Comment:
This is my very first foray into the Python
interpreter, so please be patient.  It looks like to me
that this INCREF is wrong since the PyList_Append()
will steal the reference.  Also I tested it.  Current
CVS does this:

>>> import gc
>>> len(gc.get_objects())
1559
>>> len(gc.get_objects())
1562
>>> len(gc.get_objects())
1565
>>> len(gc.get_objects())
1568
>>> len(gc.get_objects())
1571
>>> len(gc.get_objects())
1574

and with my patch it does this:

>>> import gc
>>> len(gc.get_objects())
1559
>>> len(gc.get_objects())
1559
>>> len(gc.get_objects())
1559
>>> len(gc.get_objects())
1559
>>> len(gc.get_objects())
1559
>>> len(gc.get_objects())
1559
>>> len(gc.get_objects())
1559


In addition I added checks for error return from
PyList_Append(), and propagated the exception condition
up the callstack.


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

>Comment By: Zooko Ozoko (zooko)
Date: 2001-11-28 16:33

Message:
Logged In: YES 
user_id=52562

Whoops.  It is against dist/src/Modules/gcmodule.c

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

Comment By: Gregory P. Smith (greg)
Date: 2001-11-28 16:30

Message:
Logged In: YES 
user_id=413

which file is the patch against?

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

Comment By: Zooko Ozoko (zooko)
Date: 2001-11-28 16:12

Message:
Logged In: YES 
user_id=52562

Oh, and here is a new version of the patch, which also tests
for failure from PyList_New().



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

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