[Pyrex] How do I subtype python internal type that is not part of a module?

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Apr 19 09:52:06 CEST 2004


Lenard Lindstrom <len-l at telus.net>:

> I have enhanced my python interpeter to allow subtyping of python
> functions and wish to create some extension types directly from
> PyFunction_Type. Unfortunately the type is not part of any module. I
> have tried the following pyrex code:

It's available in the "types" module, so you should be
able to say
  
  cdef extern from "python.h":
    ctypedef class types.FunctionType [object PyFunctionObject]:
      pass

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list