[3.12] gh-110782: Fix crash when TypeVar is constructed with keyword args (GH-110784) (#110787)

gh-110782: Fix crash when TypeVar is constructed with keyword args (GH-110784)
(cherry picked from commit d2a536b170)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Miss Islington (bot) 2023-10-13 01:24:37 +02:00 committed by GitHub
parent 80f958529b
commit 27d5ea291c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 18 deletions

View file

@ -554,6 +554,12 @@ class TypeVarTests(BaseTestCase):
vals[x] = cls(str(x))
del vals
def test_constructor(self):
T = TypeVar(name="T")
self.assertEqual(T.__name__, "T")
self.assertEqual(T.__constraints__, ())
self.assertIs(T.__bound__, None)
def template_replace(templates: list[str], replacements: dict[str, list[str]]) -> list[tuple[str]]:
"""Renders templates with possible combinations of replacements.