Skip to content

Commit fb68617

Browse files
committed
Add test showing del cursor.row_factory then executing query causes segfault
1 parent df2538a commit fb68617

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/test/test_sqlite3/test_factory.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ def test_delete_connection_text_factory(self):
156156
with self.assertRaises(AttributeError):
157157
del self.con.text_factory
158158

159+
def test_delete_cursor_row_factory(self):
160+
# gh-149738: deleting row_factory should raise an exception
161+
cur = self.con.cursor()
162+
del cur.row_factory
163+
# Executing a query here should succeed.
164+
self.assertEqual(tuple(cur.execute("select 1").fetchone()), (1,))
165+
159166
def test_sqlite_row_index_unicode(self):
160167
row = self.con.execute("select 1 as \xff").fetchone()
161168
self.assertEqual(row["\xff"], 1)

0 commit comments

Comments
 (0)