Skip to content

Commit 4c4a17e

Browse files
Apply suggestions from code review
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
1 parent cc08d14 commit 4c4a17e

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

doc/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ Sentinel objects
10761076
A type used to define sentinel values. The *name* argument should be the
10771077
name of the variable to which the return value shall be assigned.
10781078

1079-
Assigning attributes to a sentinel including `__weakref__` is forbidden.
1079+
Assigning attributes to a sentinel is deprecated.
10801080

10811081
Example::
10821082

@@ -1101,7 +1101,7 @@ Sentinel objects
11011101
Automatic `repr` string no longer has angle brackets.
11021102
`repr` parameter was deprecated.
11031103
`name` as a keyword is deprecated.
1104-
Subclasssing and attribute assignment are deprecated.
1104+
Subclassing and attribute assignment are deprecated.
11051105

11061106

11071107
Pure aliases

src/typing_extensions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def __init__(
193193
) -> None:
194194
if name is not _sentinel_placeholder:
195195
warnings.warn(
196-
"'name' is positional-only and must not be a keyword parameter",
196+
"Passing 'name' as a keyword argument is deprecated; pass it positionally instead.",
197197
DeprecationWarning,
198198
stacklevel=2,
199199
)
@@ -202,7 +202,7 @@ def __init__(
202202
raise TypeError("First parameter 'name' is required")
203203
if repr is not None:
204204
warnings.warn(
205-
"'repr' is deprecated and must be removed",
205+
"The 'repr' parameter is deprecated and will be removed in Python 3.15.",
206206
DeprecationWarning,
207207
stacklevel=2,
208208
)
@@ -215,7 +215,7 @@ def __init__(
215215

216216
def __init_subclass__(cls):
217217
warnings.warn(
218-
"Subclassing sentinel is forbidden by PEP 661",
218+
"Subclassing sentinel is deprecated and will be disallowed in Python 3.15",
219219
DeprecationWarning,
220220
stacklevel=2,
221221
)
@@ -224,7 +224,7 @@ def __init_subclass__(cls):
224224
def __setattr__(self, attr: str, value: object) -> None:
225225
if attr not in {"__name__", "_repr", "__module__"}:
226226
warnings.warn(
227-
"Setting attributes on sentinel is deprecated",
227+
f"Setting attribute {attr!r} on sentinel objects is deprecated and will be disallowed in Python 3.15.",
228228
DeprecationWarning,
229229
stacklevel=2,
230230
)

0 commit comments

Comments
 (0)