Commit 86afa0ad authored by Fantix King's avatar Fantix King Committed by Denis Bilenko

psycopg2_pool.py: use integer_types #38

parent a58b7a6c
...@@ -8,6 +8,12 @@ from gevent.socket import wait_read, wait_write ...@@ -8,6 +8,12 @@ from gevent.socket import wait_read, wait_write
from psycopg2 import extensions, OperationalError, connect from psycopg2 import extensions, OperationalError, connect
if sys.version_info[0] >= 3:
integer_types = int,
else:
integer_types = int, long
def gevent_wait_callback(conn, timeout=None): def gevent_wait_callback(conn, timeout=None):
"""A wait callback useful to allow gevent to work with Psycopg.""" """A wait callback useful to allow gevent to work with Psycopg."""
while 1: while 1:
...@@ -29,7 +35,7 @@ extensions.set_wait_callback(gevent_wait_callback) ...@@ -29,7 +35,7 @@ extensions.set_wait_callback(gevent_wait_callback)
class DatabaseConnectionPool(object): class DatabaseConnectionPool(object):
def __init__(self, maxsize=100): def __init__(self, maxsize=100):
if not isinstance(maxsize, (int, long)): if not isinstance(maxsize, integer_types):
raise TypeError('Expected integer, got %r' % (maxsize, )) raise TypeError('Expected integer, got %r' % (maxsize, ))
self.maxsize = maxsize self.maxsize = maxsize
self.pool = Queue() self.pool = Queue()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment