From 844831c14fed941bc206525bdeb9d7541b97d322 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 25 Jun 2012 14:25:36 -0400 Subject: notify_all workaround for 2.5 --- lib/sqlalchemy/util/queue.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/util/queue.py') 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() -- cgit v1.2.1