]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-132604: Track deprecation related to runtime-checkable protocols (3.20) (#154790)
authorBartosz Sławecki <bartosz@ilikepython.com>
Tue, 28 Jul 2026 10:27:31 +0000 (12:27 +0200)
committerGitHub <noreply@github.com>
Tue, 28 Jul 2026 10:27:31 +0000 (12:27 +0200)
* Track deprecation related to runtime-checkable protocols until 3.20

* Add deprecation note to 3.15 what's new

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

index 011565dfbb090d4e8bf6ff3eea34ee6dc32a67c9..d771764502c91036e929e6b8aad2bc817ef2335d 100644 (file)
@@ -53,3 +53,12 @@ Pending removal in Python 3.20
 
   * Creating instances of abstract AST nodes (such as :class:`ast.AST`
     or :class:`!ast.expr`) is deprecated and will raise an error in Python 3.20.
+
+* :mod:`typing`:
+
+  * It is deprecated to call :func:`isinstance` and :func:`issubclass` checks on
+    protocol classes that were not explicitly decorated with :func:`!runtime_checkable`
+    but that inherit from a runtime-checkable protocol class.
+    This will raise a :exc:`TypeError` in Python 3.20.
+
+    (Contributed by Bartosz Sławecki in :gh:`132604`.)
index 250558dd1341a499fb7f1d1a02341def78cf2ca2..daac31fd7f4b17cbd3631c0fbd2edb4cf49fa74b 100644 (file)
@@ -2317,6 +2317,13 @@ New deprecations
     :func:`issubclass`, but warnings were not previously emitted if it was
     merely imported or accessed from the :mod:`!typing` module.
 
+  * It is deprecated to call :func:`isinstance` and :func:`issubclass` checks on
+    protocol classes that were not explicitly decorated with :func:`!runtime_checkable`
+    but that inherit from a runtime-checkable protocol class.
+    This will raise a :exc:`TypeError` in Python 3.20.
+
+    (Contributed by Bartosz Sławecki in :gh:`132604`.)
+
 
 * :mod:`webbrowser`: