Thanks for the clues, I made a modification so that reduce returns this.. return Py_BuildValue("O(OOOOO)", Py_TYPE(self), PyTuple_New(0), Py_None, Py_None, Py_None );
and now I get this different error when trying to pickle the type.. ---------------------------------------------------------------------- Traceback (most recent call last): File "test_missing.py", line 16, in test print cPickle.dumps( mv ) PicklingError: Can't pickle <type 'MV'>: attribute lookup __builtin__.MV failed thx, S One grep through the source later: > > >>> slice(1,2,3).__reduce__() > (<type 'slice'>, (1, 2, 3)) > > And the implementation seems straightforward: > > static PyObject * > slice_reduce(PySliceObject* self) > { > return Py_BuildValue("O(OOO)", Py_TYPE(self), self->start, self->stop, > self->step); > } > > > > (*) it uses __getnewargs__ > > > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list