mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
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
1 changed files with 5 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue