Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
86afa0ad
Commit
86afa0ad
authored
Dec 16, 2013
by
Fantix King
Committed by
Denis Bilenko
Dec 16, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
psycopg2_pool.py: use integer_types #38
parent
a58b7a6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
examples/psycopg2_pool.py
examples/psycopg2_pool.py
+7
-1
No files found.
examples/psycopg2_pool.py
View file @
86afa0ad
...
...
@@ -8,6 +8,12 @@ from gevent.socket import wait_read, wait_write
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
):
"""A wait callback useful to allow gevent to work with Psycopg."""
while
1
:
...
...
@@ -29,7 +35,7 @@ extensions.set_wait_callback(gevent_wait_callback)
class
DatabaseConnectionPool
(
object
):
def
__init__
(
self
,
maxsize
=
100
):
if
not
isinstance
(
maxsize
,
(
int
,
long
)
):
if
not
isinstance
(
maxsize
,
integer_types
):
raise
TypeError
(
'Expected integer, got %r'
%
(
maxsize
,
))
self
.
maxsize
=
maxsize
self
.
pool
=
Queue
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment