Allow 0 as key in the pool

Close #848
This commit is contained in:
Daniele Varrazzo 2019-03-17 18:22:17 +00:00
parent 155c739863
commit b4b470c29a

View File

@ -95,11 +95,11 @@ class AbstractConnectionPool(object):
"""Put away a connection."""
if self.closed:
raise PoolError("connection pool is closed")
if key is None:
key = self._rused.get(id(conn))
if not key:
raise PoolError("trying to put unkeyed connection")
if key is None:
raise PoolError("trying to put unkeyed connection")
if len(self._pool) < self.minconn and not close:
# Return the connection into a consistent state before putting