classification
Title: Misleading documentation about weakrefs
Type: behavior Stage: committed/rejected
Components: Documentation Versions: Python 3.3, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, fdrake, ncoghlan, pitrou, python-dev, sbt, tim_one
Priority: normal Keywords:

Created on 2012-05-28 13:17 by pitrou, last changed 2012-06-15 17:16 by pitrou. This issue is now closed.

Messages (2)
msg161780 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-28 13:17
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.
msg162922 - (view) Author: Roundup Robot (python-dev) Date: 2012-06-15 17:15
New changeset 69177ff1a643 by Antoine Pitrou in branch '3.2':
Issue #14933: fix misleading doc about weakref support in extension types.
http://hg.python.org/cpython/rev/69177ff1a643

New changeset b17c8005e08a by Antoine Pitrou in branch 'default':
Issue #14933: fix misleading doc about weakref support in extension types.
http://hg.python.org/cpython/rev/b17c8005e08a

New changeset 0ac1f90954dc by Antoine Pitrou in branch '2.7':
Issue #14933: fix misleading doc about weakref support in extension types.
http://hg.python.org/cpython/rev/0ac1f90954dc
History
Date User Action Args
2012-06-15 17:16:14pitrousetstatus: open -> closed
resolution: fixed
stage: committed/rejected
2012-06-15 17:15:58python-devsetnosy: + python-dev
messages: + msg162922
2012-05-28 13:17:39pitroucreate