diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-06-29 08:28:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-29 08:28:15 (GMT) |
commit | 6cb145d23f5cf69b6d7414877d142747cd3d134c (patch) | |
tree | 0617efcd6911c14a1b8003bb9bee5fc68e521103 /Misc | |
parent | 20a88004bae8ead66a205a125e1fe979376fc3ea (diff) | |
download | cpython-6cb145d23f5cf69b6d7414877d142747cd3d134c.zip cpython-6cb145d23f5cf69b6d7414877d142747cd3d134c.tar.gz cpython-6cb145d23f5cf69b6d7414877d142747cd3d134c.tar.bz2 |
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.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2021-06-21-10-46-58.bpo-44471.2QjXv_.rst | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2021-06-21-10-46-58.bpo-44471.2QjXv_.rst b/Misc/NEWS.d/next/Library/2021-06-21-10-46-58.bpo-44471.2QjXv_.rst new file mode 100644 index 0000000..0675ef3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-06-21-10-46-58.bpo-44471.2QjXv_.rst @@ -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. |