Skip to content

Commit

Permalink
Clarify error message for non @runtime_checkable decorated protocols (
Browse files Browse the repository at this point in the history
  • Loading branch information
XuehaiPan committed May 23, 2023
1 parent 356934c commit b306e56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Unreleased

- Change deprecated `@runtime` to formal API `@runtime_checkable` in the error
message. Patch by Xuehai Pan.

# Release 4.6.0 (May 22, 2023)

- `typing_extensions` is now documented at
Expand Down
2 changes: 1 addition & 1 deletion src/typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ def _proto_hook(other):
if _allow_reckless_class_checks():
return NotImplemented
raise TypeError("Instance and class checks can only be used with"
" @runtime protocols")
" @runtime_checkable protocols")
if not isinstance(other, type):
# Same error as for issubclass(1, int)
raise TypeError('issubclass() arg 1 must be a class')
Expand Down

0 comments on commit b306e56

Please sign in to comment.