mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 12:50:32 +03:00
Raise PoolError when putting a connection not belonging to the pool
A KeyError was raised instead.
This commit is contained in:
parent
de6f2ac387
commit
4fd5f3267b
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue
Block a user