mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
#2196 hasattr now allows SystemExit and KeyboardInterrupt to propagate
This commit is contained in:
parent
42bfa90f02
commit
b9030f4f0d
3 changed files with 20 additions and 3 deletions
|
|
@ -590,6 +590,16 @@ def test_hasattr(self):
|
|||
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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue