[Python-checkins] bpo-38062: [doc] clarify that atexit uses equality comparisons internally. (GH-26935)

iritkatriel webhook-mailer at python.org
Tue Jun 29 13:28:13 EDT 2021


https://github.com/python/cpython/commit/12803c59d54ff1a45a5b08cef82652ef199b3b07
commit: 12803c59d54ff1a45a5b08cef82652ef199b3b07
branch: main
author: Jack DeVries <58614260+jdevries3133 at users.noreply.github.com>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2021-06-29T18:28:03+01:00
summary:

bpo-38062: [doc] clarify that atexit uses equality comparisons internally. (GH-26935)

files:
A Misc/NEWS.d/next/Documentation/2021-06-28-12-13-48.bpo-38062.9Ehp9O.rst
M Doc/library/atexit.rst

diff --git a/Doc/library/atexit.rst b/Doc/library/atexit.rst
index e6fa33ac3eaa3..f7f038107d11f 100644
--- a/Doc/library/atexit.rst
+++ b/Doc/library/atexit.rst
@@ -48,11 +48,12 @@ internal error is detected, or when :func:`os._exit` is called.
 
 .. function:: unregister(func)
 
-   Remove *func* from the list of functions to be run at interpreter
-   shutdown.  After calling :func:`unregister`, *func* is guaranteed not to be
-   called when the interpreter shuts down, even if it was registered more than
-   once.  :func:`unregister` silently does nothing if *func* was not previously
-   registered.
+   Remove *func* from the list of functions to be run at interpreter shutdown.
+   :func:`unregister` silently does nothing if *func* was not previously
+   registered.  If *func* has been registered more than once, every occurrence
+   of that function in the :mod:`atexit` call stack will be removed.  Equality
+   comparisons (``==``) are used internally during unregistration, so function
+   references do not need to have matching identities.
 
 
 .. seealso::
diff --git a/Misc/NEWS.d/next/Documentation/2021-06-28-12-13-48.bpo-38062.9Ehp9O.rst b/Misc/NEWS.d/next/Documentation/2021-06-28-12-13-48.bpo-38062.9Ehp9O.rst
new file mode 100644
index 0000000000000..1d90096e20bfa
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2021-06-28-12-13-48.bpo-38062.9Ehp9O.rst
@@ -0,0 +1 @@
+Clarify that atexit uses equality comparisons internally.



More information about the Python-checkins mailing list