Can you access the c object of a python object directly? Can this be
done in ctypes or directly throught python functions without reverting
to forking the python module?

scanario:
I have pyctx object that i get in python like this:

pyctx = cairo.Context(surface)

defined in the python extension this:

typedef struct {
    PyObject_HEAD
    cairo_t *ctx;
    PyObject *base; /* base object used to create context, or NULL */
} PycairoContext;

PyObject *
PycairoContext_FromContext(cairo_t *ctx, PyTypeObject *type, PyObject
*base)
{
    PyObject *o;

    assert (ctx != NULL);

    if (Pycairo_Check_Status (cairo_status (ctx))) {
        cairo_destroy (ctx);
        return NULL;
    }

    if (type == NULL)
        type = &PycairoContext_Type;
    o = PycairoContext_Type.tp_alloc (type, 0);
    if (o) {
        ((PycairoContext *)o)->ctx = ctx;
        Py_XINCREF(base);
        ((PycairoContext *)o)->base = base;
    } else {
        cairo_destroy (ctx);
    }
    return o;
}

Now my question is:
Is there any way to access/get a pointer to PycairoContext->ctx from
python object (pyctx)?

A long shot i know :-)

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to