Make super() internal errors RuntimeError instead of SystemError (closes #15839)
diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py
index 32eb1c0..f6469cf 100644
--- a/Lib/test/test_super.py
+++ b/Lib/test/test_super.py
@@ -115,6 +115,21 @@
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)