Author: Brian Kearns <bdkea...@gmail.com>
Branch: 
Changeset: r62144:a511e6de3ae1
Date: 2013-03-06 16:45 -0500
http://bitbucket.org/pypy/pypy/changeset/a511e6de3ae1/

Log:    more small cleanups for sqlite

diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -741,7 +741,6 @@
 
 class Cursor(object):
     __initialized = False
-    __connection = None
     __statement = None
 
     def __init__(self, con):
@@ -763,11 +762,10 @@
         self.__rowcount = -1
 
     def __del__(self):
-        if self.__connection:
-            try:
-                self.__connection._cursors.remove(weakref.ref(self))
-            except ValueError:
-                pass
+        try:
+            self.__connection._cursors.remove(weakref.ref(self))
+        except (AttributeError, ValueError):
+            pass
         if self.__statement:
             self.__statement._reset()
 
@@ -866,8 +864,8 @@
                     self.__connection._in_transaction = \
                             not 
sqlite.sqlite3_get_autocommit(self.__connection._db)
                     raise self.__connection._get_exception(ret)
+                self.__statement._reset()
                 self.__rowcount += 
sqlite.sqlite3_changes(self.__connection._db)
-            self.__statement._reset()
         finally:
             self.__locked = False
 
@@ -1097,9 +1095,6 @@
                                  str(type(param)))
 
     def _set_params(self, params):
-        ret = sqlite.sqlite3_reset(self._statement)
-        if ret != SQLITE_OK:
-            raise self.__con._get_exception(ret)
         self._in_use = True
 
         num_params_needed = 
sqlite.sqlite3_bind_parameter_count(self._statement)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to