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