-
Kevin Modzelewski authored
isinstance(obj, cls) needs to do a bunch of dynamic checking: it needs to check cls's class to see if it defines __instancecheck__, and it needs to fetch __class__ on obj. Most of those time those aren't overridden, so __instancecheck__ gets skipped and __class__ returns the type of the object. So use the same "type slot" machinery to cache whether an __instancecheck__ or custom __class__ attribute have gotten added. These are a bit different than the other slots since they are not "wrappers", they are simply bools that say whether or not the attribute exists. This makes the slot handling code a bit messier / more divergent from CPython, but I think it still makes sense to put this here since we get the hooking-on-attribute-updating and update-all-subclasses-as-well automatically.
d9709d1d