mirror of
https://github.com/python/cpython.git
synced 2025-11-27 13:45:25 +00:00
bpo-44471: Change error type for bad objects in ExitStack.enter_context() (GH-26820)
A TypeError is now raised instead of an AttributeError in ExitStack.enter_context() and AsyncExitStack.enter_async_context() for objects which do not support the context manager or asynchronous context manager protocols correspondingly.
This commit is contained in:
parent
20a88004ba
commit
6cb145d23f
6 changed files with 91 additions and 8 deletions
|
|
@ -0,0 +1,5 @@
|
|||
A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in
|
||||
:meth:`contextlib.ExitStack.enter_context` and
|
||||
:meth:`contextlib.AsyncExitStack.enter_async_context` for objects which do
|
||||
not support the :term:`context manager` or :term:`asynchronous context
|
||||
manager` protocols correspondingly.
|
||||
Loading…
Add table
Add a link
Reference in a new issue