This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients terry.reedy
Date 2020-04-04.19:28:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586028529.92.0.773288395215.issue40180@roundup.psfhosted.org>
In-reply-to
Content
Consider class Object defined as follows:

import types
class Type(type):
    __class__ = property({}.__getitem__, {}.__setitem__)
class Object(metaclass=Type):
    __slots__ = '__class__'

isinstance(Object, ob) is true for type and Type and false for anything else.  But for the examples of the latter that I tried, (list, int, types.CodeType, types.MethodType, see attached tem3.py), it incorrectly raises
  KeyError: <class '__main__.Object'> 

I cannot find the C source for isinstance.  In Python/bltinmodule.c, function builtin_isinstance_impl wraps
  retval = PyObject_IsInstance(obj, class_or_tuple);
but grepping for PyObject_IsInstance in *.c and *.h only returned other calls.
History
Date User Action Args
2020-04-04 19:28:49terry.reedysetrecipients: + terry.reedy
2020-04-04 19:28:49terry.reedysetmessageid: <1586028529.92.0.773288395215.issue40180@roundup.psfhosted.org>
2020-04-04 19:28:49terry.reedylinkissue40180 messages
2020-04-04 19:28:49terry.reedycreate