mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Make super() internal errors RuntimeError instead of SystemError (closes #15839)
This commit is contained in:
parent
9f16e44a47
commit
6a42bd67d7
3 changed files with 24 additions and 7 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue