[Python-checkins] cpython (merge 3.2 -> default): Issue #14954: Clarify the interaction of weak references and garbage collection.
antoine.pitrou
python-checkins at python.org
Tue Aug 21 00:11:33 CEST 2012
http://hg.python.org/cpython/rev/57c9ed276332
changeset: 78687:57c9ed276332
parent: 78685:9b28dff66ac3
parent: 78686:8600ae913b63
user: Antoine Pitrou <solipsis at pitrou.net>
date: Tue Aug 21 00:07:35 2012 +0200
summary:
Issue #14954: Clarify the interaction of weak references and garbage collection.
Patch by Ethan Furman.
files:
Doc/library/weakref.rst | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst
--- a/Doc/library/weakref.rst
+++ b/Doc/library/weakref.rst
@@ -24,7 +24,10 @@
A weak reference to an object is not enough to keep the object alive: when the
only remaining references to a referent are weak references,
:term:`garbage collection` is free to destroy the referent and reuse its memory
-for something else. A primary use for weak references is to implement caches or
+for something else. However, until the object is actually destroyed the weak
+reference may return the object even if there are no strong references to it.
+
+A primary use for weak references is to implement caches or
mappings holding large objects, where it's desired that a large object not be
kept alive solely because it appears in a cache or mapping.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list