bpo-44092: Don't reset statements/cursors before rollback (GH-26026)

In SQLite versions pre 3.7.11, pending statements would block a rollback.  This is no longer the case, so remove the workaround.
This commit is contained in:
Erlend Egeberg Aasland 2022-01-03 20:02:39 +01:00 committed by GitHub
parent 9d35dedc5e
commit 9d6a239a34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 52 deletions

View file

@ -231,28 +231,6 @@ class RegressionTests(unittest.TestCase):
with self.assertRaises(sqlite.ProgrammingError):
cur = con.cursor()
def test_cursor_registration(self):
"""
Verifies that subclassed cursor classes are correctly registered with
the connection object, too. (fetch-across-rollback problem)
"""
class Connection(sqlite.Connection):
def cursor(self):
return Cursor(self)
class Cursor(sqlite.Cursor):
def __init__(self, con):
sqlite.Cursor.__init__(self, con)
con = Connection(":memory:")
cur = con.cursor()
cur.execute("create table foo(x)")
cur.executemany("insert into foo(x) values (?)", [(3,), (4,), (5,)])
cur.execute("select x from foo")
con.rollback()
with self.assertRaises(sqlite.InterfaceError):
cur.fetchall()
def test_auto_commit(self):
"""
Verifies that creating a connection in autocommit mode works.