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.""" """Put away a connection."""
if self.closed: if self.closed:
raise PoolError("connection pool is closed") raise PoolError("connection pool is closed")
if key is None: if key is None:
key = self._rused.get(id(conn)) key = self._rused.get(id(conn))
if key is None:
if not key: raise PoolError("trying to put unkeyed connection")
raise PoolError("trying to put unkeyed connection")
if len(self._pool) < self.minconn and not close: if len(self._pool) < self.minconn and not close:
# Return the connection into a consistent state before putting # Return the connection into a consistent state before putting