New submission from Antoine Pitrou <pit...@free.fr>:

In 
http://docs.python.org/dev/extending/newtypes.html?highlight=pyobject_clearweakrefs#weak-reference-support,
 you can read:

“The only further addition is that the destructor needs to call the weak 
reference manager to clear any weak references. This should be done before any 
other parts of the destruction have occurred”

I don't believe there is any need to clear weakrefs before starting with other 
parts of the destruction. Weakref callbacks cannot access the original object, 
by construction (else they never get called).

Actually, if a weakref callback can rely on some resources having been released 
(say, a file descriptor), it is better to clear the weakrefs *after* other 
parts of the destruction.

This seems to be a by-product of the erroneous doc committed in SVN r16381, 
part of which was removed in r18223.

----------
assignee: docs@python
components: Documentation
messages: 161780
nosy: docs@python, fdrake, ncoghlan, pitrou, sbt, tim_one
priority: normal
severity: normal
status: open
title: Misleading documentation about weakrefs
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14933>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to