summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2013-11-24 10:53:45 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2013-11-24 10:53:45 (GMT)
commitc49477b1848d5f7f1a98c6f19931d75c29019c7e (patch)
tree275eebd3cfdb4667b15880767536173b351bb3c6 /Objects/object.c
parent4c05d3bc561dcdd70dd0d268fa769197334349a8 (diff)
downloadcpython-c49477b1848d5f7f1a98c6f19931d75c29019c7e.zip
cpython-c49477b1848d5f7f1a98c6f19931d75c29019c7e.tar.gz
cpython-c49477b1848d5f7f1a98c6f19931d75c29019c7e.tar.bz2
Make Ellipsis and NotImplemented picklable through the reduce protocol.
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 395e28d..11718aa 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1465,6 +1465,17 @@ NotImplemented_repr(PyObject *op)
}
static PyObject *
+NotImplemented_reduce(PyObject *op)
+{
+ return PyUnicode_FromString("NotImplemented");
+}
+
+static PyMethodDef notimplemented_methods[] = {
+ {"__reduce__", (PyCFunction)NotImplemented_reduce, METH_NOARGS, NULL},
+ {NULL, NULL}
+};
+
+static PyObject *
notimplemented_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
if (PyTuple_GET_SIZE(args) || (kwargs && PyDict_Size(kwargs))) {
@@ -1511,7 +1522,7 @@ static PyTypeObject PyNotImplemented_Type = {
0, /*tp_weaklistoffset */
0, /*tp_iter */
0, /*tp_iternext */
- 0, /*tp_methods */
+ notimplemented_methods, /*tp_methods */
0, /*tp_members */
0, /*tp_getset */
0, /*tp_base */