From 4fd5f3267b4590eaaa619bc2db5d46e272ee4850 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 30 Jun 2011 15:53:31 +0100 Subject: [PATCH] Raise PoolError when putting a connection not belonging to the pool A KeyError was raised instead. --- lib/pool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pool.py b/lib/pool.py index 8a8fa539..51445257 100644 --- a/lib/pool.py +++ b/lib/pool.py @@ -115,7 +115,7 @@ class AbstractConnectionPool(object): def _putconn(self, conn, key=None, close=False): """Put away a connection.""" if self.closed: raise PoolError("connection pool is closed") - if key is None: key = self._rused[id(conn)] + if key is None: key = self._rused.get(id(conn)) if not key: raise PoolError("trying to put unkeyed connection")