On Sun, 17 Mar 2013 02:59:12 +0600, Stefan Behnel <stefan...@behnel.de> wrote:

In case you are interested in how to hit this line, declare in some .pxd:

    cdef extern from "Python.h":
ctypedef class __builtin__.BaseException [object PyBaseExceptionObject]:
            pass

Why would you need to do that in your code?

It makes Cython treat BaseException as an extension type
(Exception is declared similarly) and allows for things like:

* Using "Exception" as a type for parameters, attributes, casts.
  All this with Cython-generated and optimized typeckecking.
* Creating Exception subclasses as cdef classes.

It's a hack, but a very useful one.

Best regards,
Nikita Nemkin
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to