From c60137b2729745defea74e7f957d8e11ba73132f Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Thu, 10 Mar 2011 11:25:44 -0800 Subject: [PATCH 1/2] Explicitly mention that people should not depend on immediate finalization of objects in the language reference. --- Doc/reference/datamodel.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 5c32f85680e..11269443416 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -69,6 +69,8 @@ are still reachable. containing circular references. See the documentation of the :mod:`gc` module for information on controlling the collection of cyclic garbage. Other implementations act differently and CPython may change. + Do not write code that depends on immediate finalization of objects + when they become unreachable (ex: always close your files). Note that the use of the implementation's tracing or debugging facilities may keep objects alive that would normally be collectable. Also note that catching From c5425472110f69b444ae224e8fd97c14ee9fcb0f Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Thu, 10 Mar 2011 11:28:50 -0800 Subject: [PATCH 2/2] Reword the finalization note. --- Doc/reference/datamodel.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 11269443416..dca01dea9d3 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -69,8 +69,8 @@ are still reachable. containing circular references. See the documentation of the :mod:`gc` module for information on controlling the collection of cyclic garbage. Other implementations act differently and CPython may change. - Do not write code that depends on immediate finalization of objects - when they become unreachable (ex: always close your files). + Do not depend on immediate finalization of objects when they become + unreachable (ex: always close files). Note that the use of the implementation's tracing or debugging facilities may keep objects alive that would normally be collectable. Also note that catching