gh-105726: Add __slots__ to AbstractContextManager and AbstractAsyncContextManager (#106771)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Grigoriev Semyon 2023-07-16 18:30:39 +03:00 committed by GitHub
parent cc25ca16ee
commit 55408f86d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 0 deletions

View file

@ -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