summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2012-07-15 01:20:37 (GMT)
committerLarry Hastings <larry@hastings.org>2012-07-15 01:20:37 (GMT)
commit1191709b1379661a15287a2c6ac8263f23655f73 (patch)
treefc1a13f3c27e7c5acce78b40a56092b7d8521550 /Doc/library
parentc4ac789be76357d7fbf85a2ba29c80f98017af70 (diff)
downloadcpython-1191709b1379661a15287a2c6ac8263f23655f73.zip
cpython-1191709b1379661a15287a2c6ac8263f23655f73.tar.gz
cpython-1191709b1379661a15287a2c6ac8263f23655f73.tar.bz2
- Issue #15233: Python now guarantees that callables registered with
the atexit module will be called in a deterministic order.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/atexit.rst15
1 files changed, 8 insertions, 7 deletions
diff --git a/Doc/library/atexit.rst b/Doc/library/atexit.rst
index 3d5c014..2e22cab 100644
--- a/Doc/library/atexit.rst
+++ b/Doc/library/atexit.rst
@@ -9,13 +9,14 @@
The :mod:`atexit` module defines functions to register and unregister cleanup
functions. Functions thus registered are automatically executed upon normal
-interpreter termination. The order in which the functions are called is not
-defined; if you have cleanup operations that depend on each other, you should
-wrap them in a function and register that one. This keeps :mod:`atexit` simple.
-
-Note: the functions registered via this module are not called when the program
-is killed by a signal not handled by Python, when a Python fatal internal error
-is detected, or when :func:`os._exit` is called.
+interpreter termination. :mod:`atexit` runs these functions in the *reverse*
+order in which they were registered; if you register ``A``, ``B``, and ``C``,
+at interpreter termination time they will be run in the order ``C``, ``B``,
+``A``.
+
+**Note:** The functions registered via this module are not called when the
+program is killed by a signal not handled by Python, when a Python fatal
+internal error is detected, or when :func:`os._exit` is called.
.. function:: register(func, *args, **kargs)