[Patches] [ python-Patches-1517042 ] Fix for Lib/test/crashers/gc_inspection.py

SourceForge.net noreply at sourceforge.net
Thu Jul 6 08:28:53 CEST 2006


Patches item #1517042, was opened at 2006-07-04 09:39
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1517042&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: Open
Resolution: None
Priority: 2
Submitted By: Collin Winter (collinwinter)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fix for Lib/test/crashers/gc_inspection.py

Initial Comment:
The attached patch fixes the bug pointed out in
crashers/gc_inspection.py, namely that
gc.get_referrers() can be used to see objects (in this
case tuples) before their built, leading to segfaults.

The patch works by modifying
Objects/abstract.c:PySequence_AsTuple, wrapping the
call to PyIter_Next() with _PyObject_GC_TRACK/UNTRACK
calls. This has the effect of hiding the being-created
tuple from gc.get_referrers() while fetching the next
item from the iterator.

Also attached is a patch to crashers/gc_inspection.py
itself, which allows the test to actually pass (the
previous version would raise IndexErrors in the event
the test passed).

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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-07-05 23:28

Message:
Logged In: YES 
user_id=33168

Note that the declaration of item needs to be moved to the
top of the scope so it can compile with C89.

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

Comment By: Raymond Hettinger (rhettinger)
Date: 2006-07-05 15:31

Message:
Logged In: YES 
user_id=80475

Crashers based on gc.get_referrers() should not be 
considered real bugs.  It is certainly not worth 
complexifying the code or slowing it down just to preclude 
these little perverse safe-cracking exercises.  Also, it 
is not worth the risk of introducing a real bug when the 
code was working fine.  

That being said, if the code is genuinely defective and 
has potential to cause real-world problems, then it should 
be fixed.  I would think that if there were a long-
standing problem with tuples, it would have manifested 
itself long ago.

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

Comment By: Collin Winter (collinwinter)
Date: 2006-07-05 10:36

Message:
Logged In: YES 
user_id=1344176

The improve_gc_inspection.patch file has been superseded by
a patch attached to bug #1517663. The bug details another
interpreter crash in the same vein as the one fix in tuple()
by this patch.

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

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


More information about the Patches mailing list