Skip to content

Commit 2f5b336

Browse files
johnslavikmiss-islington
authored andcommitted
gh-132604: Track deprecation related to runtime-checkable protocols (3.20) (GH-154790)
* Track deprecation related to runtime-checkable protocols until 3.20 * Add deprecation note to 3.15 what's new (cherry picked from commit b4db948) Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
1 parent 2e2dc91 commit 2f5b336

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

Doc/deprecations/pending-removal-in-3.20.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,12 @@ Pending removal in Python 3.20
5353

5454
* Creating instances of abstract AST nodes (such as :class:`ast.AST`
5555
or :class:`!ast.expr`) is deprecated and will raise an error in Python 3.20.
56+
57+
* :mod:`typing`:
58+
59+
* It is deprecated to call :func:`isinstance` and :func:`issubclass` checks on
60+
protocol classes that were not explicitly decorated with :func:`!runtime_checkable`
61+
but that inherit from a runtime-checkable protocol class.
62+
This will raise a :exc:`TypeError` in Python 3.20.
63+
64+
(Contributed by Bartosz Sławecki in :gh:`132604`.)

Doc/whatsnew/3.15.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,6 +2301,13 @@ New deprecations
23012301
:func:`issubclass`, but warnings were not previously emitted if it was
23022302
merely imported or accessed from the :mod:`!typing` module.
23032303

2304+
* It is deprecated to call :func:`isinstance` and :func:`issubclass` checks on
2305+
protocol classes that were not explicitly decorated with :func:`!runtime_checkable`
2306+
but that inherit from a runtime-checkable protocol class.
2307+
This will raise a :exc:`TypeError` in Python 3.20.
2308+
2309+
(Contributed by Bartosz Sławecki in :gh:`132604`.)
2310+
23042311

23052312
* :mod:`webbrowser`:
23062313

0 commit comments

Comments
 (0)