diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-08-15 03:07:47 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-08-15 03:07:47 (GMT) |
commit | 1f9d907c9009daf169d5d6fcdcef72f85fc6f3ac (patch) | |
tree | 7c223ce1e52c1472222c879bb30bf9baa3976490 /Lib | |
parent | e1e48ea29bc04cff9739f6ab4cb991604060a55f (diff) | |
download | cpython-1f9d907c9009daf169d5d6fcdcef72f85fc6f3ac.zip cpython-1f9d907c9009daf169d5d6fcdcef72f85fc6f3ac.tar.gz cpython-1f9d907c9009daf169d5d6fcdcef72f85fc6f3ac.tar.bz2 |
Issue 3514: Fixed segfault dues to infinite loop in __getattr__.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/pickletester.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index c9ebdb8..a622145 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -868,6 +868,14 @@ class AbstractPickleTests(unittest.TestCase): y = self.loads(s) self.assertEqual(y._reduce_called, 1) + def test_bad_getattr(self): + x = BadGetattr() + for proto in 0, 1: + self.assertRaises(RuntimeError, self.dumps, x, proto) + # protocol 2 don't raise a RuntimeError. + d = self.dumps(x, 2) + self.assertRaises(RuntimeError, self.loads, d) + # Test classes for reduce_ex class REX_one(object): @@ -949,6 +957,10 @@ class SimpleNewObj(object): # raise an error, to make sure this isn't called raise TypeError("SimpleNewObj.__init__() didn't expect to get called") +class BadGetattr: + def __getattr__(self, key): + self.foo + class AbstractPickleModuleTests(unittest.TestCase): def test_dump_closed_file(self): |