-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-104555: Runtime-checkable protocols: Don't let previous calls to `…
…isinstance()` influence whether `issubclass()` raises an exception (#104559) Co-authored-by: Carl Meyer <carl@oddbird.net>
- Loading branch information
1 parent
2f369ca
commit b27fe67
Showing
3 changed files
with
96 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
Misc/NEWS.d/next/Library/2023-05-17-16-58-23.gh-issue-104555.5rb5oM.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Fix issue where an :func:`issubclass` check comparing a class ``X`` against a | ||
:func:`runtime-checkable protocol <typing.runtime_checkable>` ``Y`` with | ||
non-callable members would not cause :exc:`TypeError` to be raised if an | ||
:func:`isinstance` call had previously been made comparing an instance of ``X`` | ||
to ``Y``. This issue was present in edge cases on Python 3.11, but became more | ||
prominent in 3.12 due to some unrelated changes that were made to | ||
runtime-checkable protocols. Patch by Alex Waygood. |