This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Raise TypeError in ExitStack.enter_context() for bad argument
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: 12022 Superseder:
Assigned To: Nosy List: ncoghlan, serhiy.storchaka, yselivanov
Priority: normal Keywords: patch

Created on 2021-06-21 07:43 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 26820 merged serhiy.storchaka, 2021-06-21 07:52
Messages (2)
msg396209 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-06-21 07:43
For consistency with the "with" statement (see issue12022) ExitStack.enter_context() should raise TypeError instead of AttributeError if the argument is not a context manager. Same for AsyncExitStack.enter_async_context().
msg396708 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-06-29 08:28
New changeset 6cb145d23f5cf69b6d7414877d142747cd3d134c by Serhiy Storchaka in branch 'main':
bpo-44471: Change error type for bad objects in ExitStack.enter_context() (GH-26820)
https://github.com/python/cpython/commit/6cb145d23f5cf69b6d7414877d142747cd3d134c
History
Date User Action Args
2022-04-11 14:59:46adminsetgithub: 88637
2021-06-29 08:29:12serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-06-29 08:28:24serhiy.storchakasetmessages: + msg396708
2021-06-21 07:53:47serhiy.storchakasetdependencies: + AttributeError should report the same details when raised by lookup_special() as when raised in the REPL
2021-06-21 07:52:43serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request25401
2021-06-21 07:43:53serhiy.storchakacreate