[Python-checkins] cpython: - Issue #15233: Python now guarantees that callables registered with
larry.hastings
python-checkins at python.org
Sun Jul 15 03:21:16 CEST 2012
http://hg.python.org/cpython/rev/f8b520b6f654
changeset: 78104:f8b520b6f654
user: Larry Hastings <larry at hastings.org>
date: Sat Jul 14 18:20:37 2012 -0700
summary:
- Issue #15233: Python now guarantees that callables registered with
the atexit module will be called in a deterministic order.
files:
Doc/library/atexit.rst | 13 +++++++------
Misc/NEWS | 3 +++
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Doc/library/atexit.rst b/Doc/library/atexit.rst
--- 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.
+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.
+**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)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -35,6 +35,9 @@
Library
-------
+- Issue #15233: Python now guarantees that callables registered with
+ the atexit module will be called in a deterministic order.
+
- Issue #15238: shutil.copystat now copies Linux "extended attributes".
- Issue #15230: runpy.run_path now correctly sets __package__ as described
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list