mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-105726: Add __slots__
to AbstractContextManager
and AbstractAsyncContextManager
(#106771)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
cc25ca16ee
commit
55408f86d7
4 changed files with 29 additions and 0 deletions
|
@ -20,6 +20,8 @@ class AbstractContextManager(abc.ABC):
|
|||
|
||||
__class_getitem__ = classmethod(GenericAlias)
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
def __enter__(self):
|
||||
"""Return `self` upon entering the runtime context."""
|
||||
return self
|
||||
|
@ -42,6 +44,8 @@ class AbstractAsyncContextManager(abc.ABC):
|
|||
|
||||
__class_getitem__ = classmethod(GenericAlias)
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
async def __aenter__(self):
|
||||
"""Return `self` upon entering the runtime context."""
|
||||
return self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue