diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst index f71bfebdb2a19a..6c699ae61f931d 100644 --- a/Doc/c-api/object.rst +++ b/Doc/c-api/object.rst @@ -433,7 +433,9 @@ Object Protocol If *cls* has a :meth:`~type.__instancecheck__` method, it will be called to determine the subclass status as described in :pep:`3119`. Otherwise, *inst* - is an instance of *cls* if its class is a subclass of *cls*. + is an instance of *cls* if its class is a subclass of *cls*. If *inst* is + an instance of *cls*, this will return ``1`` and will not call + :meth:`~type.__instancecheck__`. An instance *inst* can override what is considered its class by having a :attr:`~object.__class__` attribute. diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 27aedfa878af9a..a0f12ae5939bce 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -2965,7 +2965,11 @@ ABCs. Return true if *instance* should be considered a (direct or indirect) instance of *class*. If defined, called to implement ``isinstance(instance, - class)``. + cls)``. + + .. note:: + If ``type(instance) is cls`` then ``isinstance(instance, cls)`` is + always ``True`` and ``__instancecheck__`` is not called. .. method:: type.__subclasscheck__(self, subclass)