forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pythongh-74690: Document changes made to runtime-checkable protocols …
…in 3.12 (python#103348) Co-authored-by: Jelle Zijlstra <[email protected]>
- Loading branch information
1 parent
5d7d86f
commit 6441365
Showing
4 changed files
with
64 additions
and
9 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
3 changes: 3 additions & 0 deletions
3
Misc/NEWS.d/next/Library/2023-04-07-15-09-26.gh-issue-74690.0f886b.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,3 @@ | ||
The members of a runtime-checkable protocol are now considered "frozen" at | ||
runtime as soon as the class has been created. See | ||
:ref:`"What's new in Python 3.12" <whatsnew-typing-py312>` for more details. |
8 changes: 8 additions & 0 deletions
8
Misc/NEWS.d/next/Library/2023-04-07-15-15-40.gh-issue-74690.un84hh.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,8 @@ | ||
The performance of :func:`isinstance` checks against | ||
:func:`runtime-checkable protocols <typing.runtime_checkable>` has been | ||
considerably improved for protocols that only have a few members. To achieve | ||
this improvement, several internal implementation details of the | ||
:mod:`typing` module have been refactored, including | ||
``typing._ProtocolMeta.__instancecheck__``, | ||
``typing._is_callable_members_only``, and ``typing._get_protocol_attrs``. | ||
Patches by Alex Waygood. |