]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-144386: Add support for descriptors in ExitStack and AsyncExitStack (#144420)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 4 Feb 2026 11:20:18 +0000 (13:20 +0200)
committerGitHub <noreply@github.com>
Wed, 4 Feb 2026 11:20:18 +0000 (13:20 +0200)
commitf73d2e70037ea0c76d03487a71790734344aa080
tree3ccf4b3b6751a5215e32c835e935c734920b4e4d
parent34e5a63f145585cbeb09f21e9453192d9b7c410c
gh-144386: Add support for descriptors in ExitStack and AsyncExitStack (#144420)

__enter__(), __exit__(), __aenter__(), and __aexit__() can now be
arbitrary descriptors, not only normal methods, for consistency with the
"with" and "async with" statements.
Doc/library/contextlib.rst
Doc/whatsnew/3.15.rst
Lib/contextlib.py
Lib/test/test_contextlib.py
Lib/test/test_contextlib_async.py
Misc/NEWS.d/next/Library/2026-02-03-14-16-49.gh-issue-144386.9Wa59r.rst [new file with mode: 0644]