]> granicus.if.org Git - python/commitdiff
Issue #9825: Remove __del__() from OrderedDict.
authorRaymond Hettinger <python@rcn.com>
Sun, 12 Sep 2010 02:11:45 +0000 (02:11 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 12 Sep 2010 02:11:45 +0000 (02:11 +0000)
Lib/collections.py
Misc/NEWS

index 10c8903697cb5d39d43d0ec3a25f1bd32333184c..b0c67a1825c10c9088399ef95dae69c8aa4c82aa 100644 (file)
@@ -173,9 +173,6 @@ class OrderedDict(dict, MutableMapping):
                    all(_imap(_eq, self.iteritems(), other.iteritems()))
         return dict.__eq__(self, other)
 
-    def __del__(self):
-        self.clear()                # eliminate cyclical references
-
 
 ################################################################################
 ### namedtuple
index b65e8609324bcf41b0d7299a15dae2394be1c3e9..a31d95aee81446089cc00f57e6b01551944c0a7c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -43,6 +43,13 @@ Core and Builtins
 Library
 -------
 
+- Issue #9825: removed __del__ from the definition of collections.OrderedDict.
+  This prevents user-created self-referencing ordered dictionaries from
+  becoming permanently uncollectable GC garbage.  The downside is that
+  removing __del__ means that the internal doubly-linked list has to wait for
+  GC collection rather than freeing memory immediately when the refcnt drops
+  to zero.
+
 - Issue #9816: random.Random.jumpahead(n) did not produce a sufficiently
   different internal state for small values of n.  Fixed by salting the 
   value.