mirror of
https://github.com/python/cpython
synced 2026-09-29 11:35:29 +03:00
Given the persistent id code a shot at a class before calling save_global().
Some persistent picklers (well, probably, the *only* persistent pickler) would like to pickle some classes in a special way.
This commit is contained in:
parent
719841e2fb
commit
39c6116483
2 changed files with 10 additions and 10 deletions
|
|
@ -2015,11 +2015,6 @@ save(Picklerobject *self, PyObject *args, int pers_save)
|
|||
}
|
||||
}
|
||||
|
||||
if (PyType_IsSubtype(type, &PyType_Type)) {
|
||||
res = save_global(self, args, NULL);
|
||||
goto finally;
|
||||
}
|
||||
|
||||
if (!pers_save && self->inst_pers_func) {
|
||||
if ((tmp = save_pers(self, args, self->inst_pers_func)) != 0) {
|
||||
res = tmp;
|
||||
|
|
@ -2027,6 +2022,11 @@ save(Picklerobject *self, PyObject *args, int pers_save)
|
|||
}
|
||||
}
|
||||
|
||||
if (PyType_IsSubtype(type, &PyType_Type)) {
|
||||
res = save_global(self, args, NULL);
|
||||
goto finally;
|
||||
}
|
||||
|
||||
if ((__reduce__ = PyDict_GetItem(dispatch_table, (PyObject *)type))) {
|
||||
Py_INCREF(__reduce__);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue