Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,14 @@ Add new function :func:`typing.is_typeddict` to introspect if an annotation
is a :class:`typing.TypedDict`.
(Contributed by Patrick Reader in :issue:`41792`)

Subclasses of ``typing.Protocol`` which only have data variables declared
will now raise a ``TypeError`` when checked with ``isinstance`` unless they
are decorated with :func:`runtime_checkable`. Previously, these checks
passed silently. Users should decorate their
subclasses with the :func:`runtime_checkable` decorator
if they want runtime protocols.
(Contributed by Yurii Karabas in :issue:`38908`)

unittest
--------

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Fix issue where :mod:`typing` protocols without the ``@runtime_checkable``
decorator did not raise a ``TypeError`` when used with ``issubclass`` and
``isinstance``. Now, subclassses of ``typing.Protocol`` will raise a
``TypeError`` when used with with those checks.
Subclasses of ``typing.Protocol`` which only have data variables declared
will now raise a ``TypeError`` when checked with ``isinstance`` unless they
are decorated with :func:`runtime_checkable`. Previously, these checks
passed silently.
Patch provided by Yurii Karabas.