Make super() internal errors RuntimeError instead of SystemError (closes #15839)

This commit is contained in:
Benjamin Peterson 2012-09-01 23:04:38 -04:00
parent 9f16e44a47
commit 6a42bd67d7
3 changed files with 24 additions and 7 deletions

View file

@ -115,6 +115,21 @@ class TestSuper(unittest.TestCase):
return __class__
self.assertIs(X.f(), X)
def test_obscure_super_errors(self):
def f():
super()
self.assertRaises(RuntimeError, f)
def f(x):
del x
super()
self.assertRaises(RuntimeError, f, None)
class X:
def f(x):
nonlocal __class__
del __class__
super()
self.assertRaises(RuntimeError, X().f)
def test_main():
support.run_unittest(TestSuper)