#!/usr/bin/python class c(object): def __getattribute__(self, attr): if attr == "__class__": print "throwing" raise KeyboardInterrupt() return object.__getattribute__(self, attr) o = c() isinstance(o, bool) print "getting here is a bug."