[pypy-dev] Pypy friendly to get pointer enclosed in python object ?

Stuart Axon stuaxo2 at yahoo.com
Sun Mar 17 08:04:29 EDT 2019


Realised I should ask this on the CFFI list, apologies for the noise.
   On Saturday, March 16, 2019, 3:05:03 PM GMT, Stuart Axon <stuaxo2 at yahoo.com> wrote:  
 
 PyCairo has a struct like
`    typedef struct { 
|    PyObject_HEAD |
|


|      cairo_t *ctx; |
|


|     PyObject *base; /* base object used to create context, or NULL */ |
|

    } PycairoContext;
`
And a #define that you can use to get pointer to ctx:
`    #define PycairoContext_GET(obj) (((PycairoContext *)(obj))->ctx)`
How can I get hold of the pointer *ctx in Pypy ?

I had a bit of a look at CFFI, but couldn't find anything using structures with PyObject_HEAD in them.



S++  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20190317/dc82853f/attachment.html>


More information about the pypy-dev mailing list