From 37dc2fffcf9f1856d04ceb42a5102fe300b44ee4 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 13 Feb 2021 17:17:28 +0100 Subject: [PATCH] Display the name in the connection pool repr --- psycopg3/psycopg3/pool.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/psycopg3/psycopg3/pool.py b/psycopg3/psycopg3/pool.py index 3a7675a9e..aced55ba7 100644 --- a/psycopg3/psycopg3/pool.py +++ b/psycopg3/psycopg3/pool.py @@ -76,6 +76,12 @@ class ConnectionPool: # Run a task to create the connections immediately self.add_task(TopUpConnections(self)) + def __repr__(self) -> str: + return ( + f"<{self.__class__.__module__}.{self.__class__.__name__}" + f" {self.name!r} at 0x{id(self):x}>" + ) + @contextmanager def connection( self, timeout_sec: Optional[float] = None -- 2.47.2