From: Mike Bayer Date: Sat, 28 Jan 2012 02:19:26 +0000 (-0500) Subject: - [bug] Added a boolean check for the "finalize" X-Git-Tag: rel_0_7_5~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5221f492ca704d75561d7729fba0fa48fd3ad0fb;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - [bug] Added a boolean check for the "finalize" function within the pool connection proxy's weakref callback before calling it, so that a warning isn't emitted that this function is None when the application is exiting and gc has removed the function from the module before the weakref callback was invoked. [ticket:2383] --- diff --git a/CHANGES b/CHANGES index 35c61afd40..7c3c6b9f7e 100644 --- a/CHANGES +++ b/CHANGES @@ -128,6 +128,14 @@ CHANGES can cause test failures on some platforms. [ticket:2379] + - [bug] Added a boolean check for the "finalize" + function within the pool connection proxy's + weakref callback before calling it, so that a + warning isn't emitted that this function is None + when the application is exiting and gc has + removed the function from the module before the + weakref callback was invoked. [ticket:2383] + - Py3K - [bug] Fixed inappropriate usage of util.py3k flag and renamed it to util.py3k_warning, since diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index 7b87cafa94..a615e8c606 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -372,7 +372,7 @@ class _ConnectionFairy(object): conn = self.connection = self._connection_record.get_connection() rec.fairy = weakref.ref( self, - lambda ref:_finalize_fairy(conn, rec, pool, ref, _echo) + lambda ref:_finalize_fairy and _finalize_fairy(conn, rec, pool, ref, _echo) ) _refs.add(rec) except: