diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2022-04-06 17:00:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-06 17:00:14 (GMT) |
commit | 884eba3c76916889fd6bff3b37b8552bfb4f9566 (patch) | |
tree | 51fd55d6170cdff327ac11d70f1e5ff1aa7e735a /Objects/clinic | |
parent | f82f9ce3239b9a7e6ffa278658dd9858f64a3c14 (diff) | |
download | cpython-884eba3c76916889fd6bff3b37b8552bfb4f9566.zip cpython-884eba3c76916889fd6bff3b37b8552bfb4f9566.tar.gz cpython-884eba3c76916889fd6bff3b37b8552bfb4f9566.tar.bz2 |
bpo-26579: Add object.__getstate__(). (GH-2821)
Copying and pickling instances of subclasses of builtin types
bytearray, set, frozenset, collections.OrderedDict, collections.deque,
weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes
implemented as slots.
Diffstat (limited to 'Objects/clinic')
-rw-r--r-- | Objects/clinic/typeobject.c.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Objects/clinic/typeobject.c.h b/Objects/clinic/typeobject.c.h index 8c70d76..dee3139 100644 --- a/Objects/clinic/typeobject.c.h +++ b/Objects/clinic/typeobject.c.h @@ -130,6 +130,24 @@ type___sizeof__(PyTypeObject *self, PyObject *Py_UNUSED(ignored)) return type___sizeof___impl(self); } +PyDoc_STRVAR(object___getstate____doc__, +"__getstate__($self, /)\n" +"--\n" +"\n" +"Helper for pickle."); + +#define OBJECT___GETSTATE___METHODDEF \ + {"__getstate__", (PyCFunction)object___getstate__, METH_NOARGS, object___getstate____doc__}, + +static PyObject * +object___getstate___impl(PyObject *self); + +static PyObject * +object___getstate__(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return object___getstate___impl(self); +} + PyDoc_STRVAR(object___reduce____doc__, "__reduce__($self, /)\n" "--\n" @@ -243,4 +261,4 @@ object___dir__(PyObject *self, PyObject *Py_UNUSED(ignored)) { return object___dir___impl(self); } -/*[clinic end generated code: output=b4fb62939b08baf9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a30090032b8e6195 input=a9049054013a1b77]*/ |