mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
complain about "global __class__" in a class body (closes #17983)
This commit is contained in:
parent
c032f16d18
commit
1e93b06007
3 changed files with 13 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue