#2196 hasattr now allows SystemExit and KeyboardInterrupt to propagate
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 1e559eb..15d80a3 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -590,6 +590,16 @@
if have_unicode:
self.assertRaises(UnicodeError, hasattr, sys, unichr(sys.maxunicode))
+ # Check that hasattr allows SystemExit and KeyboardInterrupts by
+ class A:
+ def __getattr__(self, what):
+ raise KeyboardInterrupt
+ self.assertRaises(KeyboardInterrupt, hasattr, A(), "b")
+ class B:
+ def __getattr__(self, what):
+ raise SystemExit
+ self.assertRaises(SystemExit, hasattr, B(), "b")
+
def test_hash(self):
hash(None)
self.assertEqual(hash(1), hash(1L))