[Python-Dev] Extending types in C - help needed

M.-A. Lemburg mal@lemburg.com
Thu, 17 Jan 2002 11:29:45 +0100


Jack Jansen wrote:
> 
> In the discussion on my request for an ("O@", typeobject,
> void **) format for PyArg_Parse and Py_BuildValue MAL suggested

Thomas Heller suggested this.

I am more in favour of
exposing the pickle reduce API through "O@", that is
have PyArgTuple_Parse() call the .__reduce__() method
of the object. This will then return (factory, state_tuple)
and these could then be exposed to the C function via two
PyObject*.

Note that there's no need for any type object magic. If this
becomes a common case, it may be worthwhile to add a tp_reduce
slot to type objects though.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/