From 34b9148407ccbb258c7f44952f6aa28a1a7bf809 Mon Sep 17 00:00:00 2001 From: Justin Su Date: Sun, 12 May 2024 03:13:34 -0400 Subject: [PATCH 1/3] Add `__slots__` to `AsyncResource` --- src/anyio/abc/_resources.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/anyio/abc/_resources.py b/src/anyio/abc/_resources.py index 9693835b..10df115a 100644 --- a/src/anyio/abc/_resources.py +++ b/src/anyio/abc/_resources.py @@ -15,6 +15,8 @@ class AsyncResource(metaclass=ABCMeta): and calls :meth:`aclose` on exit. """ + __slots__ = () + async def __aenter__(self: T) -> T: return self From 9bc6f53a94ef2f3522914f62de5d39d636b96db0 Mon Sep 17 00:00:00 2001 From: Justin Su Date: Sun, 12 May 2024 03:24:54 -0400 Subject: [PATCH 2/3] Update versionhistory.rst --- docs/versionhistory.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst index 245cb02d..962bfd39 100644 --- a/docs/versionhistory.rst +++ b/docs/versionhistory.rst @@ -28,6 +28,8 @@ This library adheres to `Semantic Versioning 2.0 `_. - 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__`` + (PR by Justin Su) **4.3.0** From 2d6aad9e3d3202dbd7e8d74a0d1086e9638224c2 Mon Sep 17 00:00:00 2001 From: Justin Su Date: Sun, 12 May 2024 03:30:25 -0400 Subject: [PATCH 3/3] Add link to PR in changelog --- docs/versionhistory.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst index 962bfd39..b6f0b7aa 100644 --- a/docs/versionhistory.rst +++ b/docs/versionhistory.rst @@ -29,7 +29,7 @@ This library adheres to `Semantic Versioning 2.0 `_. ``MemoryObjectSendStream`` that were garbage collected without being closed (PR by Andrey Kazantcev) - Added ``__slots__`` to ``AsyncResource`` so that child classes can use ``__slots__`` - (PR by Justin Su) + (`#733 `_; PR by Justin Su) **4.3.0**