Skip to content

Commit

Permalink
Added __slots__ to AsyncResource (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
injust committed May 12, 2024
1 parent 96920b0 commit dfc44cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/versionhistory.rst
Expand Up @@ -28,6 +28,8 @@ This library adheres to `Semantic Versioning 2.0 <http://semver.org/>`_.
- Emit a ``ResourceWarning`` for ``MemoryObjectReceiveStream`` and
``MemoryObjectSendStream`` that were garbage collected without being closed (PR by
Andrey Kazantcev)
- Added ``__slots__`` to ``AsyncResource`` so that child classes can use ``__slots__``
(`#733 <https://github.com/agronholm/anyio/pull/733>`_; PR by Justin Su)

**4.3.0**

Expand Down
2 changes: 2 additions & 0 deletions src/anyio/abc/_resources.py
Expand Up @@ -15,6 +15,8 @@ class AsyncResource(metaclass=ABCMeta):
and calls :meth:`aclose` on exit.
"""

__slots__ = ()

async def __aenter__(self: T) -> T:
return self

Expand Down

0 comments on commit dfc44cf

Please sign in to comment.