cpython: c6753db9c6af (original) (raw)
Mercurial > cpython
changeset 31592:c6753db9c6af legacy-trunk
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 .
Christian Tismer tismer@stackless.com | |
---|---|
date | Thu, 26 Feb 2004 16:21:45 +0000 |
parents | 26a80f0af9f3 |
children | 706d6d11ee36 |
files | Modules/cPickle.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-)[+] [-] Modules/cPickle.c 5 |
line wrap: on
line diff
--- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -2418,6 +2418,11 @@ save(Picklerobject *self, PyObject args 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;