summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-04-20 20:24:35 (GMT)
committerGitHub <noreply@github.com>2020-04-20 20:24:35 (GMT)
commit41660cac63c1a216e43335007e329e213054100e (patch)
treea064da64f7a23e52220923aad6675c5567028979 /Lib/test
parent887ff8e37e238fbce18c647e588283904f38ab24 (diff)
downloadcpython-41660cac63c1a216e43335007e329e213054100e.zip
cpython-41660cac63c1a216e43335007e329e213054100e.tar.gz
cpython-41660cac63c1a216e43335007e329e213054100e.tar.bz2
bpo-39942:Fix failure in `TypeVar` when missing `__name__` (GH-19616)
https://bugs.python.org/issue39942 (cherry picked from commit a25a04fea5446b1712cde0cff556574be139285a) Co-authored-by: HongWeipeng <hongweichen8888@sina.com>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_typing.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index ded5a8b..bdd7acd 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -220,6 +220,13 @@ class TypeVarTests(BaseTestCase):
with self.assertRaises(TypeError):
TypeVar('X', str, float, bound=Employee)
+ def test_missing__name__(self):
+ # See bpo-39942
+ code = ("import typing\n"
+ "T = typing.TypeVar('T')\n"
+ )
+ exec(code, {})
+
def test_no_bivariant(self):
with self.assertRaises(ValueError):
TypeVar('T', covariant=True, contravariant=True)