diff --git a/MySQLdb/cursors.py b/MySQLdb/cursors.py index 1e0a3f94..a7def7f9 100644 --- a/MySQLdb/cursors.py +++ b/MySQLdb/cursors.py @@ -60,11 +60,10 @@ class BaseCursor(object): InternalError, ProgrammingError, NotSupportedError _defer_warnings = False + connection = None def __init__(self, connection): - from weakref import ref - - self.connection = ref(connection) + self.connection = connection self.description = None self.description_flags = None self.rowcount = -1 @@ -81,7 +80,7 @@ def __init__(self, connection): def close(self): """Close the cursor. No further queries will be possible.""" try: - if self.connection is None or self.connection() is None: + if self.connection is None: return while self.nextset(): pass @@ -192,8 +191,6 @@ def setoutputsizes(self, *args): def _get_db(self): con = self.connection - if con is not None: - con = con() if con is None: raise ProgrammingError("cursor closed") return con