summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-08-05 21:26:40 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-08-05 21:26:40 (GMT)
commit58720d6145eca69b9aa45b720cb3c1376b1ddaea (patch)
tree56a90729aff1127491b8f895b40b4159ca3dce56 /Doc/reference
parentc53204b9477a2e28b6b366fd271f61c73b805cee (diff)
downloadcpython-58720d6145eca69b9aa45b720cb3c1376b1ddaea.zip
cpython-58720d6145eca69b9aa45b720cb3c1376b1ddaea.tar.gz
cpython-58720d6145eca69b9aa45b720cb3c1376b1ddaea.tar.bz2
Issue #17934: Add a clear() method to frame objects, to help clean up expensive details (local variables) and break reference cycles.
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/datamodel.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 95028c2..a88d562 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -934,6 +934,20 @@ Internal types
frame). A debugger can implement a Jump command (aka Set Next Statement)
by writing to f_lineno.
+ Frame objects support one method:
+
+ .. method:: frame.clear()
+
+ This method clears all references to local variables held by the
+ frame. Also, if the frame belonged to a generator, the generator
+ is finalized. This helps break reference cycles involving frame
+ objects (for example when catching an exception and storing its
+ traceback for later use).
+
+ :exc:`RuntimeError` is raised if the frame is currently executing.
+
+ .. versionadded:: 3.4
+
Traceback objects
.. index::
object: traceback