diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-06-29 08:27:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-29 08:27:04 (GMT) |
commit | 20a88004bae8ead66a205a125e1fe979376fc3ea (patch) | |
tree | 6b8007ba8c981cfdb52cc0a674e0491588ab50e0 /Doc/whatsnew | |
parent | 48e3a1d95aee013974121fcafe19816c0e9a41da (diff) | |
download | cpython-20a88004bae8ead66a205a125e1fe979376fc3ea.zip cpython-20a88004bae8ead66a205a125e1fe979376fc3ea.tar.gz cpython-20a88004bae8ead66a205a125e1fe979376fc3ea.tar.bz2 |
bpo-12022: Change error type for bad objects in "with" and "async with" (GH-26809)
A TypeError is now raised instead of an AttributeError in
"with" and "async with" statements for objects which do not
support the context manager or asynchronous context manager
protocols correspondingly.
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.11.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index cc88c41..be1423b 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -76,6 +76,12 @@ Other Language Changes ====================== +* A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in + :keyword:`with` and :keyword:`async with` statements for objects which do not + support the :term:`context manager` or :term:`asynchronous context manager` + protocols correspondingly. + (Contributed by Serhiy Storchaka in :issue:`12022`.) + New Modules =========== |