diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-10-19 15:34:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-19 15:34:25 (GMT) |
commit | 91a6e98e927ac529adeff57d33e87abcf448efec (patch) | |
tree | ef56163a734c39957a7df0e9f5e7130c0ea1c7e2 /Doc/whatsnew/2.7.rst | |
parent | cdcab408a017fd8059921ffa0b4ee85be16e1e87 (diff) | |
download | cpython-91a6e98e927ac529adeff57d33e87abcf448efec.zip cpython-91a6e98e927ac529adeff57d33e87abcf448efec.tar.gz cpython-91a6e98e927ac529adeff57d33e87abcf448efec.tar.bz2 |
[3.12] GH-101100: Fix reference warnings for ``__enter__`` and ``__exit__`` (GH-110112) (#111075)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Diffstat (limited to 'Doc/whatsnew/2.7.rst')
-rw-r--r-- | Doc/whatsnew/2.7.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst index 7c81cc1..6413877 100644 --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -930,8 +930,8 @@ Optimizations Several performance enhancements have been added: * A new opcode was added to perform the initial setup for - :keyword:`with` statements, looking up the :meth:`__enter__` and - :meth:`__exit__` methods. (Contributed by Benjamin Peterson.) + :keyword:`with` statements, looking up the :meth:`~object.__enter__` and + :meth:`~object.__exit__` methods. (Contributed by Benjamin Peterson.) * The garbage collector now performs better for one common usage pattern: when many objects are being allocated without deallocating @@ -2449,13 +2449,13 @@ that may require changes to your code: (Changed by Eric Smith; :issue:`5920`.) * Because of an optimization for the :keyword:`with` statement, the special - methods :meth:`__enter__` and :meth:`__exit__` must belong to the object's + methods :meth:`~object.__enter__` and :meth:`~object.__exit__` must belong to the object's type, and cannot be directly attached to the object's instance. This affects new-style classes (derived from :class:`object`) and C extension types. (:issue:`6101`.) * Due to a bug in Python 2.6, the *exc_value* parameter to - :meth:`__exit__` methods was often the string representation of the + :meth:`~object.__exit__` methods was often the string representation of the exception, not an instance. This was fixed in 2.7, so *exc_value* will be an instance as expected. (Fixed by Florent Xicluna; :issue:`7853`.) |