Skip to content

Commit ce6f79c

Browse files
committed
Remove __reduce__ from ZstdDict
We should instead document that to pickle a dictionary a user should use the `.dict_content` attribute.
1 parent 79e174f commit ce6f79c

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

Modules/_zstd/clinic/zdict.c.h

Lines changed: 1 addition & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_zstd/zdict.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -129,36 +129,10 @@ _zstd_ZstdDict___init___impl(ZstdDict *self, PyObject *dict_content,
129129
return 0;
130130
}
131131

132-
133-
/*[clinic input]
134-
_zstd.ZstdDict.__reduce__
135-
136-
137-
Intentionally not supporting pickle.
138-
[clinic start generated code]*/
139-
140-
static PyObject *
141-
_zstd_ZstdDict___reduce___impl(ZstdDict *self)
142-
/*[clinic end generated code: output=5c9b8a3550429417 input=2d69a2b4775ff76d]*/
143-
{
144-
PyErr_SetString(PyExc_TypeError,
145-
"ZstdDict object intentionally doesn't support pickle. If you need "
146-
"to save zstd dictionary to disk, please save .dict_content "
147-
"attribute, it's a bytes object. So that the zstd dictionary "
148-
"can be used with other programs.");
149-
return NULL;
150-
}
151-
152132
#define clinic_state() (get_zstd_state(type))
153133
#include "clinic/zdict.c.h"
154134
#undef clinic_state
155135

156-
static PyMethodDef ZstdDict_methods[] = {
157-
_ZSTD_ZSTDDICT___REDUCE___METHODDEF
158-
159-
{0}
160-
};
161-
162136
PyDoc_STRVAR(ZstdDict_dictid_doc,
163137
"ID of zstd dictionary, a 32-bit unsigned int value.\n\n"
164138
"Non-zero means ordinary dictionary, was created by zstd functions, follow\n"
@@ -270,7 +244,6 @@ ZstdDict_length(ZstdDict *self)
270244
}
271245

272246
static PyType_Slot zstddict_slots[] = {
273-
{Py_tp_methods, ZstdDict_methods},
274247
{Py_tp_members, ZstdDict_members},
275248
{Py_tp_getset, ZstdDict_getset},
276249
{Py_tp_new, _zstd_ZstdDict_new},

0 commit comments

Comments
 (0)