mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-39942:Fix failure in TypeVar
when missing __name__
(GH-19616)
https://bugs.python.org/issue39942
This commit is contained in:
parent
eba9f6155d
commit
a25a04fea5
3 changed files with 13 additions and 1 deletions
|
@ -221,6 +221,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue