mirror of https://github.com/python/cpython.git
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 .
This commit is contained in:
parent
d594849c42
commit
2460c62152
|
@ -2418,6 +2418,11 @@ save(Picklerobject *self, PyObject *args, int pers_save)
|
|||
case 'f':
|
||||
if (type == &PyFunction_Type) {
|
||||
res = save_global(self, args, NULL);
|
||||
if (res && PyErr_ExceptionMatches(PickleError)) {
|
||||
/* fall back to reduce */
|
||||
PyErr_Clear();
|
||||
break;
|
||||
}
|
||||
goto finally;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue