Skip to content

Commit 8450e8a

Browse files
bpo-38908: [docs] Add changes to 3.10 whatsnew and fix some minor inaccuracies in news (GH-26096)
The fix only applies to ``isinstance``. ``issubclass`` isn't affected (because it was always working to begin with). So I also fixed the news to reflect that.
1 parent 563bd5a commit 8450e8a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Doc/whatsnew/3.10.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,14 @@ Add new function :func:`typing.is_typeddict` to introspect if an annotation
13171317
is a :class:`typing.TypedDict`.
13181318
(Contributed by Patrick Reader in :issue:`41792`)
13191319
1320+
Subclasses of ``typing.Protocol`` which only have data variables declared
1321+
will now raise a ``TypeError`` when checked with ``isinstance`` unless they
1322+
are decorated with :func:`runtime_checkable`. Previously, these checks
1323+
passed silently. Users should decorate their
1324+
subclasses with the :func:`runtime_checkable` decorator
1325+
if they want runtime protocols.
1326+
(Contributed by Yurii Karabas in :issue:`38908`)
1327+
13201328
unittest
13211329
--------
13221330
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Fix issue where :mod:`typing` protocols without the ``@runtime_checkable``
2-
decorator did not raise a ``TypeError`` when used with ``issubclass`` and
3-
``isinstance``. Now, subclassses of ``typing.Protocol`` will raise a
4-
``TypeError`` when used with with those checks.
1+
Subclasses of ``typing.Protocol`` which only have data variables declared
2+
will now raise a ``TypeError`` when checked with ``isinstance`` unless they
3+
are decorated with :func:`runtime_checkable`. Previously, these checks
4+
passed silently.
55
Patch provided by Yurii Karabas.

0 commit comments

Comments
 (0)