From: Mike Bayer Date: Wed, 27 Aug 2008 05:58:18 +0000 (+0000) Subject: critical fix to r5028 repairs SingleThreadPool to return a connection in case one... X-Git-Tag: rel_0_5rc1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad6f9325383ee933060105fe71b61ca03049a6b6;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git critical fix to r5028 repairs SingleThreadPool to return a connection in case one had been removed via cleanup() --- diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index c0d98ffc47..c2a150d332 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -527,14 +527,16 @@ class SingletonThreadPool(Pool): def do_get(self): try: - return self._conn.current() - except AttributeError: - c = self.create_connection() - self._conn.current = weakref.ref(c) - self._all_conns.add(c) - if len(self._all_conns) > self.size: - self.cleanup() + c = self._conn.current() return c + except AttributeError: + pass + c = self.create_connection() + self._conn.current = weakref.ref(c) + self._all_conns.add(c) + if len(self._all_conns) > self.size: + self.cleanup() + return c class QueuePool(Pool): """A Pool that imposes a limit on the number of open connections.