From 3f6571db0c7f70ccdf92a5c57df8dc9a3a9c1c5c Mon Sep 17 00:00:00 2001 From: John Seong Date: Sun, 28 Dec 2025 17:11:29 -0800 Subject: [PATCH] gh-143089: Fix ParamSpec docstring to use list syntax instead of tuple Type checkers (mypy and pyright) require ParamSpec defaults to use list syntax, not tuple syntax. Updated the docstring examples to use [int, str] instead of (int, str) to match the typing specification and avoid misleading users. --- 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\