complain about "global __class__" in a class body (closes #17983)

This commit is contained in:
Benjamin Peterson 2013-05-15 16:17:25 -05:00
parent c032f16d18
commit 1e93b06007
3 changed files with 13 additions and 0 deletions

View file

@ -743,6 +743,10 @@ class ScopeTests(unittest.TestCase):
del tester
self.assertIsNone(ref())
def test__Class__Global(self):
s = "class X:\n global __class__\n def f(self): super()"
self.assertRaises(SyntaxError, exec, s)
def test_main():
run_unittest(ScopeTests)