Skip to content

Commit 73e1ddb

Browse files
author
Erlend E. Aasland
committed
Add regression tests for stmt exit from cursor
1 parent 1bbb31f commit 73e1ddb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Lib/sqlite3/test/regression.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,26 @@ def test_return_empty_bytestring(self):
436436
val = cur.fetchone()[0]
437437
self.assertEqual(val, b'')
438438

439+
def test_table_lock_cursor_replace_stmt(self):
440+
con = sqlite.connect(":memory:")
441+
cur = con.cursor()
442+
cur.execute("create table t(t)")
443+
cur.executemany("insert into t values(?)", ((v,) for v in range(5)))
444+
con.commit()
445+
cur.execute("select t from t")
446+
cur.execute("drop table t")
447+
con.commit()
448+
449+
def test_table_lock_cursor_dealloc(self):
450+
con = sqlite.connect(":memory:")
451+
con.execute("create table t(t)")
452+
con.executemany("insert into t values(?)", ((v,) for v in range(5)))
453+
con.commit()
454+
cur = con.execute("select t from t")
455+
del cur
456+
con.execute("drop table t")
457+
con.commit()
458+
439459

440460
def suite():
441461
tests = [

0 commit comments

Comments
 (0)