[Python-checkins] cpython (2.7): revert 030e100f048a (#29006, #10513)

benjamin.peterson python-checkins at python.org
Thu Jan 12 02:40:44 EST 2017


https://hg.python.org/cpython/rev/dd13098a5dc2
changeset:   106099:dd13098a5dc2
branch:      2.7
parent:      105952:74eb71b91112
user:        Benjamin Peterson <benjamin at python.org>
date:        Wed Jan 11 23:39:58 2017 -0800
summary:
  revert 030e100f048a (#29006, #10513)

files:
  Lib/sqlite3/test/regression.py |  30 ----------------------
  Misc/NEWS                      |   6 ++--
  Modules/_sqlite/connection.c   |   1 +
  3 files changed, 4 insertions(+), 33 deletions(-)


diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py
--- a/Lib/sqlite3/test/regression.py
+++ b/Lib/sqlite3/test/regression.py
@@ -328,36 +328,6 @@
         self.assertRaises(ValueError, cur.execute, " \0select 2")
         self.assertRaises(ValueError, cur.execute, "select 2\0")
 
-    def CheckCommitCursorReset(self):
-        """
-        Connection.commit() did reset cursors, which made sqlite3
-        to return rows multiple times when fetched from cursors
-        after commit. See issues 10513 and 23129 for details.
-        """
-        con = sqlite.connect(":memory:")
-        con.executescript("""
-        create table t(c);
-        create table t2(c);
-        insert into t values(0);
-        insert into t values(1);
-        insert into t values(2);
-        """)
-
-        self.assertEqual(con.isolation_level, "")
-
-        counter = 0
-        for i, row in enumerate(con.execute("select c from t")):
-            con.execute("insert into t2(c) values (?)", (i,))
-            con.commit()
-            if counter == 0:
-                self.assertEqual(row[0], 0)
-            elif counter == 1:
-                self.assertEqual(row[0], 1)
-            elif counter == 2:
-                self.assertEqual(row[0], 2)
-            counter += 1
-        self.assertEqual(counter, 3, "should have returned exactly three rows")
-
 
 def suite():
     regression_suite = unittest.makeSuite(RegressionTests, "Check")
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,9 @@
 Library
 -------
 
+- Issue #29006: Revert change from issue #10513 for making sqlite more liable to
+  emit "database table is locked" errors.
+
 - Issue #29094: Offsets in a ZIP file created with extern file object and mode
   "w" now are relative to the start of the file.
 
@@ -225,9 +228,6 @@
 
 - Issue #19884: Avoid spurious output on OS X with Gnu Readline.
 
-- Issue #10513: Fix a regression in Connection.commit().  Statements should
-  not be reset after a commit.
-
 - Issue #2466: posixpath.ismount now correctly recognizes mount points which
   the user does not have permission to access.
 
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -467,6 +467,7 @@
     }
 
     if (self->inTransaction) {
+        pysqlite_do_all_statements(self, ACTION_RESET, 0);
 
         Py_BEGIN_ALLOW_THREADS
         rc = sqlite3_prepare(self->db, "COMMIT", -1, &statement, &tail);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list