Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 95df3fd commit 99d1700Copy full SHA for 99d1700
1 file changed
Doc/lib/libinspect.tex
@@ -321,3 +321,19 @@ \subsection{The interpreter stack
321
Return a list of frame records for the stack below the current
322
exception.
323
\end{funcdesc}
324
+
325
+Stackframes stored directly or indirectly in local variables can
326
+easily cause reference cycles. Though the cycle detector will catch
327
+these, destruction of the frames (and local variables) can be made
328
+deterministic by removing the cycle in a \keyword{finally} clause.
329
+This is also important if the cycle detector was disabled when Python
330
+was compiled or using \function{gc.disable()}. For example:
331
332
+\begin{verbatim}
333
+def handle_stackframe_without_leak():
334
+ frame = inspect.currentframe()
335
+ try:
336
+ # do something with the frame
337
+ finally:
338
+ del frame
339
+\end{verbatim}
0 commit comments