diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-10-25 15:56:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-25 15:56:17 (GMT) |
commit | 0aaecb30483e98fc29c1f4253967d05da092f0c5 (patch) | |
tree | 032e7740735acb59bad34d19b37aef4bf0c1b6c1 /Modules | |
parent | af891a962b62268d76ace0d4768ab0e1934a2cd1 (diff) | |
download | cpython-0aaecb30483e98fc29c1f4253967d05da092f0c5.zip cpython-0aaecb30483e98fc29c1f4253967d05da092f0c5.tar.gz cpython-0aaecb30483e98fc29c1f4253967d05da092f0c5.tar.bz2 |
[3.9] bpo-41052: Fix pickling heap types implemented in C with protocols 0 and 1 (GH-22870). (GH-22963)
(cherry picked from commit 8cd1dbae32d9303caac3a473d3332f17bc98c921)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_randommodule.c | 17 | ||||
-rw-r--r-- | Modules/clinic/_randommodule.c.h | 19 |
2 files changed, 1 insertions, 35 deletions
diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c index 1b01491..a402b93 100644 --- a/Modules/_randommodule.c +++ b/Modules/_randommodule.c @@ -537,29 +537,12 @@ random_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } -/*[clinic input] - -_random.Random.__reduce__ - -[clinic start generated code]*/ - -static PyObject * -_random_Random___reduce___impl(RandomObject *self) -/*[clinic end generated code: output=ddea0dcdb60ffd6d input=bd38ec35fd157e0f]*/ -{ - PyErr_Format(PyExc_TypeError, - "cannot pickle %s object", - Py_TYPE(self)->tp_name); - return NULL; -} - static PyMethodDef random_methods[] = { _RANDOM_RANDOM_RANDOM_METHODDEF _RANDOM_RANDOM_SEED_METHODDEF _RANDOM_RANDOM_GETSTATE_METHODDEF _RANDOM_RANDOM_SETSTATE_METHODDEF _RANDOM_RANDOM_GETRANDBITS_METHODDEF - _RANDOM_RANDOM___REDUCE___METHODDEF {NULL, NULL} /* sentinel */ }; diff --git a/Modules/clinic/_randommodule.c.h b/Modules/clinic/_randommodule.c.h index 0a642df..a467811 100644 --- a/Modules/clinic/_randommodule.c.h +++ b/Modules/clinic/_randommodule.c.h @@ -114,21 +114,4 @@ _random_Random_getrandbits(RandomObject *self, PyObject *arg) exit: return return_value; } - -PyDoc_STRVAR(_random_Random___reduce____doc__, -"__reduce__($self, /)\n" -"--\n" -"\n"); - -#define _RANDOM_RANDOM___REDUCE___METHODDEF \ - {"__reduce__", (PyCFunction)_random_Random___reduce__, METH_NOARGS, _random_Random___reduce____doc__}, - -static PyObject * -_random_Random___reduce___impl(RandomObject *self); - -static PyObject * -_random_Random___reduce__(RandomObject *self, PyObject *Py_UNUSED(ignored)) -{ - return _random_Random___reduce___impl(self); -} -/*[clinic end generated code: output=d8a99be3f1192219 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a7feb0c9c8d1b627 input=a9049054013a1b77]*/ |