From 08d230a5408e9fac3adbb357f5fb4a43958991d4 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 22 May 2015 11:02:49 +0300 Subject: Issue #24257: Fixed incorrect uses of PyObject_IsInstance(). Fixed segmentation fault in sqlite3.Row constructor with faked cursor type. Fixed system error in the comparison of faked types.SimpleNamespace. --- Lib/sqlite3/test/factory.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Lib/sqlite3/test/factory.py') diff --git a/Lib/sqlite3/test/factory.py b/Lib/sqlite3/test/factory.py index 98dcae5d6c..a8348b4626 100644 --- a/Lib/sqlite3/test/factory.py +++ b/Lib/sqlite3/test/factory.py @@ -162,6 +162,14 @@ class RowFactoryTests(unittest.TestCase): self.assertEqual(list(reversed(row)), list(reversed(as_tuple))) self.assertIsInstance(row, Sequence) + def CheckFakeCursorClass(self): + # Issue #24257: Incorrect use of PyObject_IsInstance() caused + # segmentation fault. + class FakeCursor(str): + __class__ = sqlite.Cursor + cur = self.con.cursor(factory=FakeCursor) + self.assertRaises(TypeError, sqlite.Row, cur, ()) + def tearDown(self): self.con.close() -- cgit v1.2.1