Patches item #1517042, was opened at 2006-07-04 16:39 Message generated for change (Comment added) made by gbrandl 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: Closed >Resolution: Rejected Priority: 2 Submitted By: Collin Winter (collinwinter) Assigned to: Neal Norwitz (nnorwitz) 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: Georg Brandl (gbrandl) Date: 2006-10-12 13:02 Message: Logged In: YES user_id=849994 Closing as well as bug #1517663. ---------------------------------------------------------------------- Comment By: Michael Hudson (mwh) Date: 2006-08-04 09:19 Message: Logged In: YES user_id=6656 I agree with arigo. Assigning to Neal so he can see this and get it off his "things to do for 2.5" list. ---------------------------------------------------------------------- Comment By: Armin Rigo (arigo) Date: 2006-07-25 18:08 Message: Logged In: YES user_id=4771 This patch is pointless. I recommend rejecting it. The crashers/gc_inspection.py was just one example among many of crashing Python with gc.get_referrers(). I don't see why we should care to fix just this specific way. What would be needed is a complete review, possibly with an API change to decouple object creation and GC registration, and appropriate documentation for extension module writers. I don't think it's likely to happen though. ---------------------------------------------------------------------- Comment By: Neal Norwitz (nnorwitz) Date: 2006-07-06 06: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 22: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 17: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 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches