From: "M.-A. Lemburg" <mal@lemburg.com>
[Metatypes, callbacks, etc.]
Wouldn't it be *much* easier to just use the copyreg/pickle API/protocol for dealing with all this ?
I *don't* think it's complicated (once you get used to metatypes).
AFAICTL, the actions needed by Jack are very similar to what pickle et al. do, and we already have all that in Python -- it's just not exposed too well at C level.
Example:
PyArg_ParseTuple(args, "O@", &factory, &tuple) would return a factory function and a tuple storing the data of the object passed to the function
while
Py_BuildValue("O@", factory, tuple) would simply call factory with tuple and use the return value as object.
(Note that void* can be wrapped into PyCObjects for "use" in Python.)
I'm not sure we talk about the same thing: we (at least me) do not want to serialize and reconstruct objects (what pickle does), we want to convert objects from Python to C (convert them to parameters usable in C API-calls), and back (convert them from handles, pointers, whatever into Python objects) having only the Python *type* object available in the latter case. Or am I missing something? Thomas