diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-09-02 03:04:38 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-09-02 03:04:38 (GMT) |
commit | 6a42bd67d7dc251ea96784c77dfc130a8456a486 (patch) | |
tree | 0d5e9b6a3616fdbaa81403a15a385dbcf50b7b33 /Lib/test/test_super.py | |
parent | 9f16e44a479d9efdfd4315df93a9e83901ef96b5 (diff) | |
download | cpython-6a42bd67d7dc251ea96784c77dfc130a8456a486.zip cpython-6a42bd67d7dc251ea96784c77dfc130a8456a486.tar.gz cpython-6a42bd67d7dc251ea96784c77dfc130a8456a486.tar.bz2 |
Make super() internal errors RuntimeError instead of SystemError (closes #15839)
Diffstat (limited to 'Lib/test/test_super.py')
-rw-r--r-- | Lib/test/test_super.py | 15 |
1 files changed, 15 insertions, 0 deletions
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 @@ 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) |