Skip to content

Commit c3e19c3

Browse files
gh-111729: update generic syntax for typing.Concatenate sample code in Doc/library/typing.rst (#111734)
use new generic syntax
1 parent 3e99c9c commit c3e19c3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Doc/library/typing.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -1145,16 +1145,13 @@ These can be used as types in annotations. They all support subscription using
11451145

11461146
from collections.abc import Callable
11471147
from threading import Lock
1148-
from typing import Concatenate, ParamSpec, TypeVar
1149-
1150-
P = ParamSpec('P')
1151-
R = TypeVar('R')
1148+
from typing import Concatenate
11521149

11531150
# Use this lock to ensure that only one thread is executing a function
11541151
# at any time.
11551152
my_lock = Lock()
11561153

1157-
def with_lock(f: Callable[Concatenate[Lock, P], R]) -> Callable[P, R]:
1154+
def with_lock[**P, R](f: Callable[Concatenate[Lock, P], R]) -> Callable[P, R]:
11581155
'''A type-safe decorator which provides a lock.'''
11591156
def inner(*args: P.args, **kwargs: P.kwargs) -> R:
11601157
# Provide the lock as the first argument.

0 commit comments

Comments
 (0)