Skip to content

Commit 3f6571d

Browse files
committed
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.
1 parent daa9aa4 commit 3f6571d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Objects/typevarobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,13 +1451,13 @@ The following syntax creates a parameter specification that defaults\n\
14511451
to a callable accepting two positional-only arguments of types int\n\
14521452
and str:\n\
14531453
\n\
1454-
type IntFuncDefault[**P = (int, str)] = Callable[P, int]\n\
1454+
type IntFuncDefault[**P = [int, str]] = Callable[P, int]\n\
14551455
\n\
14561456
For compatibility with Python 3.11 and earlier, ParamSpec objects\n\
14571457
can also be created as follows::\n\
14581458
\n\
14591459
P = ParamSpec('P')\n\
1460-
DefaultP = ParamSpec('DefaultP', default=(int, str))\n\
1460+
DefaultP = ParamSpec('DefaultP', default=[int, str])\n\
14611461
\n\
14621462
Parameter specification variables exist primarily for the benefit of\n\
14631463
static type checkers. They are used to forward the parameter types of\n\

0 commit comments

Comments
 (0)