Kaydet (Commit) 2460c621 authored tarafından Christian Tismer's avatar Christian Tismer

made cPickle fall back to the copy_reg/reduce protocol,

if a function cannot be stored as global.
This is for compatibility with pickle.py .
üst d594849c
...@@ -2418,6 +2418,11 @@ save(Picklerobject *self, PyObject *args, int pers_save) ...@@ -2418,6 +2418,11 @@ save(Picklerobject *self, PyObject *args, int pers_save)
case 'f': case 'f':
if (type == &PyFunction_Type) { if (type == &PyFunction_Type) {
res = save_global(self, args, NULL); res = save_global(self, args, NULL);
if (res && PyErr_ExceptionMatches(PickleError)) {
/* fall back to reduce */
PyErr_Clear();
break;
}
goto finally; goto finally;
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment