diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-22 08:02:49 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-22 08:02:49 (GMT) |
commit | 08d230a5408e9fac3adbb357f5fb4a43958991d4 (patch) | |
tree | 94e66616cc67b6d1164d87f9bf694a6850b982ff /Lib/test | |
parent | df9ba3623a1fcb745199b723ffd68e63f7a31153 (diff) | |
download | cpython-08d230a5408e9fac3adbb357f5fb4a43958991d4.zip cpython-08d230a5408e9fac3adbb357f5fb4a43958991d4.tar.gz cpython-08d230a5408e9fac3adbb357f5fb4a43958991d4.tar.bz2 |
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.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_types.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index ec10752..849cba9 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -1169,6 +1169,22 @@ class SimpleNamespaceTests(unittest.TestCase): self.assertEqual(ns, ns_roundtrip, pname) + def test_fake_namespace_compare(self): + # Issue #24257: Incorrect use of PyObject_IsInstance() caused + # SystemError. + class FakeSimpleNamespace(str): + __class__ = types.SimpleNamespace + self.assertFalse(types.SimpleNamespace() == FakeSimpleNamespace()) + self.assertTrue(types.SimpleNamespace() != FakeSimpleNamespace()) + with self.assertRaises(TypeError): + types.SimpleNamespace() < FakeSimpleNamespace() + with self.assertRaises(TypeError): + types.SimpleNamespace() <= FakeSimpleNamespace() + with self.assertRaises(TypeError): + types.SimpleNamespace() > FakeSimpleNamespace() + with self.assertRaises(TypeError): + types.SimpleNamespace() >= FakeSimpleNamespace() + def test_main(): run_unittest(TypesTests, MappingProxyTests, ClassCreationTests, |