Commit 923df348 authored by Kevin Modzelewski's avatar Kevin Modzelewski

I guess exception handling is supposed to check __subclasscheck__

parent 8497cc62
# expected: fail
# - don't support this stuff yet
# Exception-catching is supposed to go through __subclasscheck__
class M(type):
def __instancecheck__(self, instance):
print "instancecheck", instance
return True
def __subclasscheck__(self, sub):
print "subclasscheck", sub
return True
class E(Exception):
__metaclass__ = M
print 1
print isinstance(E(), E) # does not print anything due to special-casing
print 2
print isinstance(1, E)
print 3
# This calls __subclasscheck__ twice...?
try:
raise E()
except E:
pass
print 4
try:
raise Exception()
except E:
pass
print 5
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment