Fix SF #749831, copy raises SystemError when getstate raises exception

This commit is contained in:
Neal Norwitz 2003-06-08 13:19:58 +00:00
parent f0b1a1fca9
commit e2fdc61004
2 changed files with 8 additions and 0 deletions

View file

@ -515,6 +515,12 @@ class TestCopy(unittest.TestCase):
self.assert_(x is not y)
self.assert_(x[0] is not y[0])
def test_getstate_exc(self):
class EvilState(object):
def __getstate__(self):
raise ValueError, "ain't got no stickin' state"
self.assertRaises(ValueError, copy.copy, EvilState())
def test_main():
test_support.run_unittest(TestCopy)