[Pyrex] Subclassing an extension type from a built-in
Michael Hordijk
hoffbrinkle at hotmail.com
Sat Oct 15 16:25:43 CEST 2005
So I've been reading the docs, googling, and reading these archives
on GMane (which has given me a bunch of ideas, thanks!). What I would
like to do is subclass the "list" built-in type. What I've got seems to
work, kinda. I can subclass and get myself a list, etc. My problem is
that I'm segfaulting when I raise an exception in __init__. Here's the
Pyrex code:
[[[
cdef extern from "Python.h":
ctypedef class types.ListType [object PyListObject]:
pass
cdef class test4(ListType):
def __init__(self):
raise StandardError
]]]
And I get this from python:
[[[
>>> import testMod
>>> a = testMod.test4()
Segmentation fault
]]]
Is it not possible to raise an exception from the initializer of an
extension type? Or am I going about the inheritance all wrong? Can I
subclass the list type?
Thanks,
michael
More information about the Pyrex
mailing list