Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-74690: Avoid a costly type check where possible in _ProtocolMeta.__subclasscheck__ #112717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
improve docstring
  • Loading branch information
AlexWaygood authored Dec 4, 2023
commit 39756114cf8b14ac8a3040af5cce6bbfdb3bf83a
3 changes: 2 additions & 1 deletion 3 Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,8 @@ def _type_check_issubclass_arg_1(arg):
in `issubclass(arg, <protocol>)`.

In most cases, this is verified by type.__subclasscheck__.
As such, we don't perform this check unless we absolutely have to.
Checking it again unnecessarily would slow down issubclass() checks,
so, we don't perform this check unless we absolutely have to.

For various error paths, however,
we want to ensure that *this* error message is shown to the user
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.