On 18/05/2013 9:59am, Antoine Pitrou wrote:
This PEP proposes to turn CI disposal into the following sequence (new
steps are in bold):
1. Weakrefs to CI objects are cleared, and their callbacks called. At
this point, the objects are still safe to use.
2. **The finalizers of all CI objects are called.**
How do you know that one of the finalizers will not do something which
causes another to fail?
Presumably the following would cause an AttributeError to be printed:
class Node:
def __init__(self):
self.next = None
def __del__(self):
print(self, self.next)
del self.next # break Node object
a = Node()
b = Node()
a.next = b
b.next = a
del a, b
gc.collect()
Are there are less contrived examples which will cause errors where
currently there are none?
--
Richard
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com