diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-06-25 14:25:36 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-06-25 14:25:36 -0400 |
commit | 844831c14fed941bc206525bdeb9d7541b97d322 (patch) | |
tree | fe62a5d8c464058b4da9bfaad6a4170e56f2ebfe /lib/sqlalchemy/util/queue.py | |
parent | cdfef65dd6ce7a9296617171b9125314999b7a9d (diff) | |
download | sqlalchemy-844831c14fed941bc206525bdeb9d7541b97d322.tar.gz |
notify_all workaround for 2.5
Diffstat (limited to 'lib/sqlalchemy/util/queue.py')
-rw-r--r-- | lib/sqlalchemy/util/queue.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/sqlalchemy/util/queue.py b/lib/sqlalchemy/util/queue.py index 9e17527b7..571456577 100644 --- a/lib/sqlalchemy/util/queue.py +++ b/lib/sqlalchemy/util/queue.py @@ -25,9 +25,18 @@ within QueuePool. from collections import deque from time import time as _time from sqlalchemy.util import threading +import sys + +if sys.version_info < (2, 6): + def notify_all(condition): + condition.notify() +else: + def notify_all(condition): + condition.notify_all() __all__ = ['Empty', 'Full', 'Queue', 'SAAbort'] + class Empty(Exception): "Exception raised by Queue.get(block=0)/get_nowait()." @@ -183,7 +192,7 @@ class Queue: if not self.not_full.acquire(False): return try: - self.not_empty.notify_all() + notify_all(self.not_empty) finally: self.not_full.release() |