summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorCarl Meyer <carl@oddbird.net>2023-09-14 16:20:32 (GMT)
committerGitHub <noreply@github.com>2023-09-14 16:20:32 (GMT)
commit909adb5092c0ae9426814742d97932204b211cfb (patch)
treeb9e6c45113475b3c96567d21c18136505283a81d /Lib
parent4a54074a0f5579d417445ec28427cd0ed5aa01f4 (diff)
downloadcpython-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.py13
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):