Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add __slots__ to AsyncResource #733

Merged
merged 3 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/versionhistory.rst
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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