1__doc__ = """ 2 >>> try: 3 ... s = Spam() 4 ... except KeyError, e: 5 ... print("Exception: %s" % e) 6 ... else: 7 ... print("Did not raise the expected exception") 8 Exception: 'This is not a spanish inquisition' 9""" 10 11import sys 12if sys.version_info[0] >= 3: 13 __doc__ = __doc__.replace("Error, e", "Error as e") 14 15cdef extern from "Python.h": 16 ctypedef class __builtin__.list [object PyListObject]: 17 pass 18 19cdef class Spam(list): 20 def __init__(self): 21 raise KeyError("This is not a spanish inquisition") 22