From b6c1db991a01e156257d34e6512557b8054ba1b4 Mon Sep 17 00:00:00 2001 From: VanshAgarwal24036 Date: Fri, 26 Dec 2025 00:32:09 +0530 Subject: [PATCH 1/3] gh-143089: Fix ParamSpec default examples to use list instead of tuple --- Objects/typevarobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objects/typevarobject.c b/Objects/typevarobject.c index 8e43962c7e37f4..2ec546aff52c0a 100644 --- a/Objects/typevarobject.c +++ b/Objects/typevarobject.c @@ -1451,13 +1451,13 @@ The following syntax creates a parameter specification that defaults\n\ to a callable accepting two positional-only arguments of types int\n\ and str:\n\ \n\ - type IntFuncDefault[**P = (int, str)] = Callable[P, int]\n\ + type IntFuncDefault[**P = [int, str]] = Callable[P, int]\n\ \n\ For compatibility with Python 3.11 and earlier, ParamSpec objects\n\ can also be created as follows::\n\ \n\ P = ParamSpec('P')\n\ - DefaultP = ParamSpec('DefaultP', default=(int, str))\n\ + DefaultP = ParamSpec('DefaultP', default=[int, str])\n\ \n\ Parameter specification variables exist primarily for the benefit of\n\ static type checkers. They are used to forward the parameter types of\n\ From df4cf50a59a3c8be33b35aaae1cdc1e5ba652eee Mon Sep 17 00:00:00 2001 From: VanshAgarwal24036 Date: Fri, 26 Dec 2025 11:59:47 +0530 Subject: [PATCH 2/3] Update remaining ParamSpec test example to use list instead of tuple --- Lib/test/test_typing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index e896df518447c5..7488f1691a50df 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -592,7 +592,7 @@ def test_constructor(self): self.assertIs(T.__contravariant__, False) self.assertIs(T.__infer_variance__, False) - T = TypeVar(name="T", default=()) + T = TypeVar(name="T", default=[]) self.assertEqual(T.__name__, "T") self.assertEqual(T.__constraints__, ()) self.assertIs(T.__bound__, None) From d9976501acb9c04ec594bd8b32283a333c211dbb Mon Sep 17 00:00:00 2001 From: VanshAgarwal24036 Date: Fri, 26 Dec 2025 13:35:23 +0530 Subject: [PATCH 3/3] Restore TypeVar default in test_typing to tuple as behavior should remain unchanged --- Lib/test/test_typing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 7488f1691a50df..e896df518447c5 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -592,7 +592,7 @@ def test_constructor(self): self.assertIs(T.__contravariant__, False) self.assertIs(T.__infer_variance__, False) - T = TypeVar(name="T", default=[]) + T = TypeVar(name="T", default=()) self.assertEqual(T.__name__, "T") self.assertEqual(T.__constraints__, ()) self.assertIs(T.__bound__, None)