diff options
author | Carl Meyer <carl@oddbird.net> | 2023-09-14 16:20:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-14 16:20:32 (GMT) |
commit | 909adb5092c0ae9426814742d97932204b211cfb (patch) | |
tree | b9e6c45113475b3c96567d21c18136505283a81d /Lib | |
parent | 4a54074a0f5579d417445ec28427cd0ed5aa01f4 (diff) | |
download | cpython-909adb5092c0ae9426814742d97932204b211cfb.zip cpython-909adb5092c0ae9426814742d97932204b211cfb.tar.gz cpython-909adb5092c0ae9426814742d97932204b211cfb.tar.bz2 |
gh-109219: propagate free vars through type param scopes (#109377)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_type_params.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_type_params.py b/Lib/test/test_type_params.py index b1848ae..25ee188 100644 --- a/Lib/test/test_type_params.py +++ b/Lib/test/test_type_params.py @@ -694,6 +694,19 @@ class TypeParamsClassScopeTest(unittest.TestCase): cls = ns["outer"]() self.assertEqual(cls.Alias.__value__, "class") + def test_nested_free(self): + ns = run_code(""" + def f(): + T = str + class C: + T = int + class D[U](T): + x = T + return C + """) + C = ns["f"]() + self.assertIn(int, C.D.__bases__) + self.assertIs(C.D.x, str) class TypeParamsManglingTest(unittest.TestCase): def test_mangling(self): |