]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43453: Update and re-add example to typing runtime_checkable (#27013)
authorandrei kulakov <andrei.avk@gmail.com>
Mon, 5 Jul 2021 16:23:42 +0000 (12:23 -0400)
committerGitHub <noreply@github.com>
Mon, 5 Jul 2021 16:23:42 +0000 (09:23 -0700)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Doc/library/typing.rst

index e9980a7745d694a1ba457002b0a2f4299a5a9285..b1d67e46fbb5d8a18e9c1e195cfeb24cf2204910 100644 (file)
@@ -1232,8 +1232,13 @@ These are not used in annotations. They are building blocks for creating generic
 
    .. note::
 
-        :func:`runtime_checkable` will check only the presence of the required methods,
-        not their type signatures.
+        :func:`runtime_checkable` will check only the presence of the required
+        methods, not their type signatures. For example, :class:`ssl.SSLObject`
+        is a class, therefore it passes an :func:`issubclass`
+        check against :data:`Callable`.  However, the
+        :meth:`ssl.SSLObject.__init__` method exists only to raise a
+        :exc:`TypeError` with a more informative message, therefore making
+        it impossible to call (instantiate) :class:`ssl.SSLObject`.
 
    .. versionadded:: 3.8