]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Display the name in the connection pool repr
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 13 Feb 2021 16:17:28 +0000 (17:17 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 12 Mar 2021 04:07:25 +0000 (05:07 +0100)
psycopg3/psycopg3/pool.py

index 3a7675a9e2aaf78ea57e011834b20c5df6b936ed..aced55ba76bc38cd2b67e1b70bdc48cc28a3e284 100644 (file)
@@ -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