From: Daniele Varrazzo Date: Sat, 13 Feb 2021 16:17:28 +0000 (+0100) Subject: Display the name in the connection pool repr X-Git-Tag: 3.0.dev0~87^2~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37dc2fffcf9f1856d04ceb42a5102fe300b44ee4;p=thirdparty%2Fpsycopg.git Display the name in the connection pool repr --- 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