[Pyrex] creating and populating Python/C structs

Christopher Armstrong radeex at gmail.com
Sun Sep 4 08:12:26 CEST 2005


On 9/5/05, Simon Burton <simon at arrowtheory.com> wrote:
> 
> It seems you need to include compile.h before frameobject.h (see attached).
> 
> Simon.

Thanks, I figured Python.h had all that stuff already included. That
got my module to compile, but newframe is just returning a string of
bytes instead of a PyFrameObject now. If I've got a cdef PyFrameObject
*frame in a 'def' python function, how do I return that as a PyObject,
i.e., an instance of types.FrameType?


> On Sun, 4 Sep 2005 14:58:58 +1000
> Christopher Armstrong <radeex at gmail.com> wrote:
> 
> > Hi all,
> >
> > I'm trying to write a small function to create Python Frame objects
> > from Python code. I've been having problems getting everything
> > working. I can get pyrex to compile to C well enough, but gcc is
> > barfing on compiling the C. I've been reading through the available
> > documentation, but haven't found anything enlightening. It seems
> > dealing with Python/C API *objects* (as opposed to functions) isn't
> > something that's done often?
> >
> > Basically, I'm doing a cdef extern from *: and then declaring the
> > PyFrameObject struct like so:
-- 
  Twisted   |  Christopher Armstrong: International Man of Twistery
   Radix    |    -- http://radix.twistedmatrix.com
            |  Release Manager, Twisted Project
  \\\V///   |    -- http://twistedmatrix.com
   |o O|    |  
w----v----w-+



More information about the Pyrex mailing list