mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Make Ellipsis and NotImplemented picklable through the reduce protocol.
This commit is contained in:
parent
4c05d3bc56
commit
c49477b184
4 changed files with 24 additions and 42 deletions
|
@ -1464,6 +1464,17 @@ NotImplemented_repr(PyObject *op)
|
|||
return PyUnicode_FromString("NotImplemented");
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue