From 604d003ab4d1084ef828ebca1b28f2bf1b93c744 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 28 Mar 2022 19:39:55 -0700 Subject: [PATCH] [3.10] bpo-28516: document contextlib.ExitStack.__enter__ behavior (GH-31636) (GH-32171) The enter_context is updated with following information: 'The :meth:`__enter__` method returns the ExitStack instance, and performs no additional operations.' Co-authored-by: Jelle Zijlstra (cherry picked from commit 86384cf83f96fcaec03e2ad6516e2e24f20d3b92) Co-authored-by: vidhya <96202776+Vidhyavinu@users.noreply.github.com> --- Doc/library/contextlib.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst index b6ec6b8c876b..0fe3206540e8 100644 --- a/Doc/library/contextlib.rst +++ b/Doc/library/contextlib.rst @@ -485,6 +485,9 @@ Functions and classes provided: # the with statement, even if attempts to open files later # in the list raise an exception + The :meth:`__enter__` method returns the :class:`ExitStack` instance, and + performs no additional operations. + Each instance maintains a stack of registered callbacks that are called in reverse order when the instance is closed (either explicitly or implicitly at the end of a :keyword:`with` statement). Note that callbacks are *not* -- 2.47.3