mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Fixes #13842: cannot pickle Ellipsis or NotImplemented.
Thanks for James Sanders for the bug report and the patch.
This commit is contained in:
parent
e976fc7464
commit
f3078fbee2
4 changed files with 42 additions and 0 deletions
|
@ -2811,6 +2811,19 @@ save_global(PicklerObject *self, PyObject *obj, PyObject *name)
|
|||
return status;
|
||||
}
|
||||
|
||||
static int
|
||||
save_ellipsis(PicklerObject *self, PyObject *obj)
|
||||
{
|
||||
return save_global(self, Py_Ellipsis, PyUnicode_FromString("Ellipsis"));
|
||||
}
|
||||
|
||||
static int
|
||||
save_notimplemented(PicklerObject *self, PyObject *obj)
|
||||
{
|
||||
return save_global(self, Py_NotImplemented,
|
||||
PyUnicode_FromString("NotImplemented"));
|
||||
}
|
||||
|
||||
static int
|
||||
save_pers(PicklerObject *self, PyObject *obj, PyObject *func)
|
||||
{
|
||||
|
@ -3114,6 +3127,14 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
|
|||
status = save_none(self, obj);
|
||||
goto done;
|
||||
}
|
||||
else if (obj == Py_Ellipsis) {
|
||||
status = save_ellipsis(self, obj);
|
||||
goto done;
|
||||
}
|
||||
else if (obj == Py_NotImplemented) {
|
||||
status = save_notimplemented(self, obj);
|
||||
goto done;
|
||||
}
|
||||
else if (obj == Py_False || obj == Py_True) {
|
||||
status = save_bool(self, obj);
|
||||
goto done;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue