From 447e585466ca362a4628d1c349fb76a810713b4f Mon Sep 17 00:00:00 2001 From: Fantix King Date: Tue, 11 Jan 2022 10:37:10 -0500 Subject: [PATCH] Add __slots__ to Connection classes --- edgedb/asyncio_client.py | 1 + edgedb/base_client.py | 9 +++++++++ edgedb/blocking_client.py | 1 + 3 files changed, 11 insertions(+) diff --git a/edgedb/asyncio_client.py b/edgedb/asyncio_client.py index f376bbec..0f53a75d 100644 --- a/edgedb/asyncio_client.py +++ b/edgedb/asyncio_client.py @@ -46,6 +46,7 @@ class AsyncIOConnection(base_client.BaseConnection): + __slots__ = ("_loop", "_holder") def __init__(self, loop, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/edgedb/base_client.py b/edgedb/base_client.py index dc3d6769..b5a72de4 100644 --- a/edgedb/base_client.py +++ b/edgedb/base_client.py @@ -39,6 +39,15 @@ class BaseConnection: _log_listeners: typing.Set[ typing.Callable[[BaseConnection_T, errors.EdgeDBMessage], None] ] + __slots__ = ( + "__weakref__", + "_protocol", + "_addr", + "_addrs", + "_config", + "_params", + "_log_listeners", + ) def __init__( self, diff --git a/edgedb/blocking_client.py b/edgedb/blocking_client.py index a8424c83..a76bb1a7 100644 --- a/edgedb/blocking_client.py +++ b/edgedb/blocking_client.py @@ -33,6 +33,7 @@ class BlockingIOConnection(base_client.BaseConnection): + __slots__ = () def connect(self, *, single_attempt=False): start = time.monotonic()