Skip to content

Commit 6fad9d7

Browse files
committed
Document that isinstance() also consults a differing __class__ attribute
1 parent 05f4669 commit 6fad9d7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎Doc/builtins/functions.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,11 @@ are always available. They are listed here in alphabetical order.
11741174
a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be
11751175
raised for an invalid type if an earlier check succeeds.
11761176

1177+
If *object* has a ``__class__`` attribute that differs from
1178+
:func:`type(object) <type>` (for example a proxy, or a :mod:`unittest.mock`
1179+
object created with a *spec*), ``True`` is also returned when that class
1180+
is a subclass of *classinfo*.
1181+
11771182
.. versionchanged:: 3.10
11781183
*classinfo* can be a :ref:`types-union`.
11791184

0 commit comments

Comments
 (0)