cpython: 74a68d86569c (original) (raw)
Mercurial > cpython
changeset 106164:74a68d86569c 2.7
Benjamin Peterson benjamin@python.org | |
---|---|
date | Mon, 16 Jan 2017 00:07:27 -0800 |
parents | a87bf2d630ed |
children | 9b22d52a6d4b |
files | Lib/sqlite3/test/regression.py Misc/NEWS Modules/_sqlite/connection.c |
diffstat | 3 files changed, 33 insertions(+), 4 deletions(-)[+] [-] Lib/sqlite3/test/regression.py 30 Misc/NEWS 6 Modules/_sqlite/connection.c 1 |
line wrap: on
line diff
--- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -328,6 +328,36 @@ class RegressionTests(unittest.TestCase) self.assertRaises(ValueError, cur.execute, " \0select 2") self.assertRaises(ValueError, cur.execute, "select 2\0")
- def CheckCommitCursorReset(self):
"""[](#l1.8)
Connection.commit() did reset cursors, which made sqlite3[](#l1.9)
to return rows multiple times when fetched from cursors[](#l1.10)
after commit. See issues 10513 and 23129 for details.[](#l1.11)
"""[](#l1.12)
con = sqlite.connect(":memory:")[](#l1.13)
con.executescript("""[](#l1.14)
create table t(c);[](#l1.15)
create table t2(c);[](#l1.16)
insert into t values(0);[](#l1.17)
insert into t values(1);[](#l1.18)
insert into t values(2);[](#l1.19)
""")[](#l1.20)
self.assertEqual(con.isolation_level, "")[](#l1.22)
counter = 0[](#l1.24)
for i, row in enumerate(con.execute("select c from t")):[](#l1.25)
con.execute("insert into t2(c) values (?)", (i,))[](#l1.26)
con.commit()[](#l1.27)
if counter == 0:[](#l1.28)
self.assertEqual(row[0], 0)[](#l1.29)
elif counter == 1:[](#l1.30)
self.assertEqual(row[0], 1)[](#l1.31)
elif counter == 2:[](#l1.32)
self.assertEqual(row[0], 2)[](#l1.33)
counter += 1[](#l1.34)
self.assertEqual(counter, 3, "should have returned exactly three rows")[](#l1.35)
+ def suite(): regression_suite = unittest.makeSuite(RegressionTests, "Check")
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -29,9 +29,6 @@ Library
- Issue #29082: Fixed loading libraries in ctypes by unicode names on Windows. Original patch by Chi Hsuan Yen. -- Issue #29006: Revert change from issue #10513 for making sqlite more liable to
- emit "database table is locked" errors. -
- Issue #29188: Support glibc 2.24 on Linux: don't use getentropy() function but read from /dev/urandom to get random bytes, for example in os.urandom(). On Linux, getentropy() is implemented which getrandom() is blocking mode, @@ -257,6 +254,9 @@ Library
- Issue #19884: Avoid spurious output on OS X with Gnu Readline. +- Issue #10513: Fix a regression in Connection.commit(). Statements should
- Issue #2466: posixpath.ismount now correctly recognizes mount points which the user does not have permission to access.
--- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -467,7 +467,6 @@ PyObject* pysqlite_connection_commit(pys } if (self->inTransaction) {
pysqlite_do_all_statements(self, ACTION_RESET, 0);[](#l3.7)
Py_BEGIN_ALLOW_THREADS rc = sqlite3_prepare(self->db, "COMMIT", -1, &statement, &tail);