keeping local state in an C extension module

Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Thu Jun 30 08:31:38 EDT 2011


Am 30.06.2011 12:07 schrieb Daniel Franke:

> Here, of course, the functions PyObjectFromRawPointer(void*) and void*
> PyRawPointerFromPyObject(PyObject*) are missing. Is there anything
> like this in the Python C-API? If not, how could it be implemented?

You could implement it as a separate class which has one (read-only or 
even hidden, seen from Python) member, the said pointer.

In its __repr__, it could nevertheless reveal some internal infos.


HTH,

Thomas



More information about the Python-list mailing list