diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2013-11-24 10:53:45 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2013-11-24 10:53:45 (GMT) |
commit | c49477b1848d5f7f1a98c6f19931d75c29019c7e (patch) | |
tree | 275eebd3cfdb4667b15880767536173b351bb3c6 /Objects/sliceobject.c | |
parent | 4c05d3bc561dcdd70dd0d268fa769197334349a8 (diff) | |
download | cpython-c49477b1848d5f7f1a98c6f19931d75c29019c7e.zip cpython-c49477b1848d5f7f1a98c6f19931d75c29019c7e.tar.gz cpython-c49477b1848d5f7f1a98c6f19931d75c29019c7e.tar.bz2 |
Make Ellipsis and NotImplemented picklable through the reduce protocol.
Diffstat (limited to 'Objects/sliceobject.c')
-rw-r--r-- | Objects/sliceobject.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c index 52f1c89..1049523 100644 --- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -33,6 +33,17 @@ ellipsis_repr(PyObject *op) return PyUnicode_FromString("Ellipsis"); } +static PyObject * +ellipsis_reduce(PyObject *op) +{ + return PyUnicode_FromString("Ellipsis"); +} + +static PyMethodDef ellipsis_methods[] = { + {"__reduce__", (PyCFunction)ellipsis_reduce, METH_NOARGS, NULL}, + {NULL, NULL} +}; + PyTypeObject PyEllipsis_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "ellipsis", /* tp_name */ @@ -61,7 +72,7 @@ PyTypeObject PyEllipsis_Type = { 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - 0, /* tp_methods */ + ellipsis_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ |