summaryrefslogtreecommitdiffstats
path: root/Objects/clinic
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-04-08 06:52:59 (GMT)
committerGitHub <noreply@github.com>2017-04-08 06:52:59 (GMT)
commit205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9 (patch)
treef23611c3139118d743b18410c07669a2f41b9d93 /Objects/clinic
parentdd9a0a14c89d57e43898d4b866b8c161e4ff8506 (diff)
downloadcpython-205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9.zip
cpython-205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9.tar.gz
cpython-205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9.tar.bz2
bpo-29914: Fix default implementations of __reduce__ and __reduce_ex__(). (#843)
object.__reduce__() no longer takes arguments, object.__reduce_ex__() now requires one argument.
Diffstat (limited to 'Objects/clinic')
-rw-r--r--Objects/clinic/typeobject.c.h41
1 files changed, 11 insertions, 30 deletions
diff --git a/Objects/clinic/typeobject.c.h b/Objects/clinic/typeobject.c.h
index 1b19ccf..2760065 100644
--- a/Objects/clinic/typeobject.c.h
+++ b/Objects/clinic/typeobject.c.h
@@ -131,61 +131,42 @@ type___sizeof__(PyTypeObject *self, PyObject *Py_UNUSED(ignored))
}
PyDoc_STRVAR(object___reduce____doc__,
-"__reduce__($self, protocol=0, /)\n"
+"__reduce__($self, /)\n"
"--\n"
"\n"
"Helper for pickle.");
#define OBJECT___REDUCE___METHODDEF \
- {"__reduce__", (PyCFunction)object___reduce__, METH_FASTCALL, object___reduce____doc__},
+ {"__reduce__", (PyCFunction)object___reduce__, METH_NOARGS, object___reduce____doc__},
static PyObject *
-object___reduce___impl(PyObject *self, int protocol);
+object___reduce___impl(PyObject *self);
static PyObject *
-object___reduce__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+object___reduce__(PyObject *self, PyObject *Py_UNUSED(ignored))
{
- PyObject *return_value = NULL;
- int protocol = 0;
-
- if (!_PyArg_ParseStack(args, nargs, "|i:__reduce__",
- &protocol)) {
- goto exit;
- }
-
- if (!_PyArg_NoStackKeywords("__reduce__", kwnames)) {
- goto exit;
- }
- return_value = object___reduce___impl(self, protocol);
-
-exit:
- return return_value;
+ return object___reduce___impl(self);
}
PyDoc_STRVAR(object___reduce_ex____doc__,
-"__reduce_ex__($self, protocol=0, /)\n"
+"__reduce_ex__($self, protocol, /)\n"
"--\n"
"\n"
"Helper for pickle.");
#define OBJECT___REDUCE_EX___METHODDEF \
- {"__reduce_ex__", (PyCFunction)object___reduce_ex__, METH_FASTCALL, object___reduce_ex____doc__},
+ {"__reduce_ex__", (PyCFunction)object___reduce_ex__, METH_O, object___reduce_ex____doc__},
static PyObject *
object___reduce_ex___impl(PyObject *self, int protocol);
static PyObject *
-object___reduce_ex__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
+object___reduce_ex__(PyObject *self, PyObject *arg)
{
PyObject *return_value = NULL;
- int protocol = 0;
-
- if (!_PyArg_ParseStack(args, nargs, "|i:__reduce_ex__",
- &protocol)) {
- goto exit;
- }
+ int protocol;
- if (!_PyArg_NoStackKeywords("__reduce_ex__", kwnames)) {
+ if (!PyArg_Parse(arg, "i:__reduce_ex__", &protocol)) {
goto exit;
}
return_value = object___reduce_ex___impl(self, protocol);
@@ -256,4 +237,4 @@ object___dir__(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return object___dir___impl(self);
}
-/*[clinic end generated code: output=ce354e436e2360a0 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=8c4c856859564eaa input=a9049054013a1b77]*/