Ticket #13864: gc_tester.patch

File gc_tester.patch, 866 bytes (added by vbraun, 7 years ago)

Evil patch to trick Python into running a garbage collection in the TripleDictEraser? callback

  • sage/structure/coerce_dict.pyx

    # HG changeset patch
    # User Volker Braun <vbraun.name@gmail.com>
    # Date 1356972479 0
    # Node ID ab63b36a87e0ab819800192be9ed128df90ee7a1
    # Parent  792be06c5cbef3dec88db9dd3f903ab29d55d4cb
    [mq]: gc_tester.patch
    
    diff --git a/sage/structure/coerce_dict.pyx b/sage/structure/coerce_dict.pyx
    a b  
    112112            sage: len(T)    # indirect doctest
    113113            0
    114114        """
     115        import gc
     116        gc.enable()
    115117        # r is a (weak) reference (typically to a parent), and it knows the
    116118        # stored key of the unique triple r() had been part of.
    117119        # We remove that unique triple from self.D
     
    131133            self.D._refcache.__delitem__((k1,k2,k3))
    132134        except KeyError:
    133135            pass
     136        gc.disable()
    134137
    135138cdef class TripleDict:
    136139    """