summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libatexit.tex
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-03-21 02:57:17 (GMT)
committerCollin Winter <collinw@gmail.com>2007-03-21 02:57:17 (GMT)
commit670e6921349dd408b6958a0c5d3b1486725f9beb (patch)
tree719d6b0e5348693a2d985dfabc5e9160f7f79108 /Doc/lib/libatexit.tex
parent450ee81b227b093eeb0b7a933fe6ddc6dc768d4a (diff)
downloadcpython-670e6921349dd408b6958a0c5d3b1486725f9beb.zip
cpython-670e6921349dd408b6958a0c5d3b1486725f9beb.tar.gz
cpython-670e6921349dd408b6958a0c5d3b1486725f9beb.tar.bz2
Patch #1680961: remove sys.exitfunc and replace it with a private C API. Also, reimplement atexit in C so it can take advantage of this private API.
Diffstat (limited to 'Doc/lib/libatexit.tex')
-rw-r--r--Doc/lib/libatexit.tex36
1 files changed, 17 insertions, 19 deletions
diff --git a/Doc/lib/libatexit.tex b/Doc/lib/libatexit.tex
index 9798b57..04f1d49 100644
--- a/Doc/lib/libatexit.tex
+++ b/Doc/lib/libatexit.tex
@@ -1,32 +1,21 @@
\section{\module{atexit} ---
Exit handlers}
-\declaremodule{standard}{atexit}
+\declaremodule{builtin}{atexit}
\moduleauthor{Skip Montanaro}{skip@mojam.com}
\sectionauthor{Skip Montanaro}{skip@mojam.com}
\modulesynopsis{Register and execute cleanup functions.}
\versionadded{2.0}
-The \module{atexit} module defines a single function to register
-cleanup functions. Functions thus registered are automatically
-executed upon normal interpreter termination.
-Note: the functions registered via this module are not called when the program is killed by a
-signal, when a Python fatal internal error is detected, or when
-\function{os._exit()} is called.
+The \module{atexit} module defines functions to register and
+unregister cleanup functions. Functions thus registered are
+automatically executed upon normal interpreter termination.
-This is an alternate interface to the functionality provided by the
-\code{sys.exitfunc} variable.
-\withsubitem{(in sys)}{\ttindex{exitfunc}}
-
-Note: This module is unlikely to work correctly when used with other code
-that sets \code{sys.exitfunc}. In particular, other core Python modules are
-free to use \module{atexit} without the programmer's knowledge. Authors who
-use \code{sys.exitfunc} should convert their code to use
-\module{atexit} instead. The simplest way to convert code that sets
-\code{sys.exitfunc} is to import \module{atexit} and register the function
-that had been bound to \code{sys.exitfunc}.
+Note: the functions registered via this module are not called when
+the program is killed by a signal, when a Python fatal internal
+error is detected, or when \function{os._exit()} is called.
\begin{funcdesc}{register}{func\optional{, *args\optional{, **kargs}}}
Register \var{func} as a function to be executed at termination. Any
@@ -47,7 +36,16 @@ chance to run the last exception to be raised is re-raised.
\versionchanged[This function now returns \var{func} which makes it
possible to use it as a decorator without binding the
- original name to \code{None}]{2.6}
+ original name to \code{None}]{2.6}
+\end{funcdesc}
+
+\begin{funcdesc}{unregister}{func}
+Remove a function \var{func} from the list of functions to be run at
+interpreter-shutdown. After calling \function{unregister()},
+\var{func} is guaranteed not to be called when the interpreter
+shuts down.
+
+\versionadded{3.0}
\end{funcdesc}