diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2014-08-13 02:37:00 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2014-08-13 02:39:16 +0100 |
commit | 41a083cec36d3688950b83603887d03213b588ea (patch) | |
tree | 7b45ad23cd9a4c0e862d318e22e5c29b2be03573 | |
parent | c475a0db95c8568972b9b724b6724f62699f691e (diff) | |
download | psycopg2-41a083cec36d3688950b83603887d03213b588ea.tar.gz |
Convert pool arguments to int
Failing to do so may cause dangerous misbehaviours such as an unbounded
pool (because of lame comparison operators in Python 2).
Fix ticket #220.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | lib/pool.py | 4 |
2 files changed, 4 insertions, 2 deletions
@@ -16,6 +16,8 @@ What's new in psycopg 2.5.4 - Added :sql:`jsonb` support for PostgreSQL 9.4. - Fixed segfault if COPY statements are executed instead of using the proper methods (:ticket:`#219`). +- Force conversion of pool arguments to integer to avoid potentially unbounded + pools (:ticket:`#220`). - Don't ignore silently the `cursor.callproc` argument without a length. - Added a few errors missing from `~psycopg2.errorcodes`, defined by PostgreSQL but not documented. diff --git a/lib/pool.py b/lib/pool.py index 3b41c80..7cdd6af 100644 --- a/lib/pool.py +++ b/lib/pool.py @@ -42,8 +42,8 @@ class AbstractConnectionPool(object): with given parameters. The connection pool will support a maximum of about 'maxconn' connections. """ - self.minconn = minconn - self.maxconn = maxconn + self.minconn = int(minconn) + self.maxconn = int(maxconn) self.closed = False self._args = args |