From 915bad12fc122014faad6e7565716f2f1fab6124 Mon Sep 17 00:00:00 2001 From: adustman Date: Thu, 19 Apr 2001 17:31:15 +0000 Subject: [PATCH] Break a cycle that prevented GC. --- mysql/MySQLdb.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mysql/MySQLdb.py b/mysql/MySQLdb.py index c5ad732..432bd59 100644 --- a/mysql/MySQLdb.py +++ b/mysql/MySQLdb.py @@ -569,10 +569,13 @@ class Connection: else: self.cursorclass = Cursor self.db = apply(connect, (), kwargs) - self.quote_conv[types.StringType] = self.Thing2Literal + self.quote_conv[types.StringType] = self.db.string_literal self._transactional = self.db.server_capabilities & CLIENT.TRANSACTIONS if _threading: self.__lock = _threading.Lock() + def __del__(self): + self.close() + if _threading: def _acquire(self, blocking=1): return self.__lock.acquire(blocking) def _release(self): return self.__lock.release() @@ -580,11 +583,6 @@ class Connection: def _acquire(self, blocking=1): return 1 def _release(self): return 1 - def Thing2Literal(self, o, d={}): - """Convert a thing to a string literal using the current - character set.""" - return self.db.string_literal(str(o)) - def close(self): """Close the connection. No further activity possible.""" self.db.close()