diff options
Diffstat (limited to 'Lib/test/test_scope.py')
-rw-r--r-- | Lib/test/test_scope.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py index 129a18aade..f4ed2442c6 100644 --- a/Lib/test/test_scope.py +++ b/Lib/test/test_scope.py @@ -714,6 +714,19 @@ class ScopeTests(unittest.TestCase): global a + def testClassNamespaceOverridesClosure(self): + # See #17853. + x = 42 + class X: + locals()["x"] = 43 + y = x + self.assertEqual(X.y, 43) + class X: + locals()["x"] = 43 + del x + self.assertFalse(hasattr(X, "x")) + self.assertEqual(x, 42) + def test_main(): run_unittest(ScopeTests) |