From: Christian Tismer Date: Thu, 26 Feb 2004 16:21:45 +0000 (+0000) Subject: made cPickle fall back to the copy_reg/reduce protocol, X-Git-Tag: v2.4a1~766 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2460c62152fe43f9da9381d09fd294f21e3640d7;p=python 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 . --- diff --git a/Modules/cPickle.c b/Modules/cPickle.c index 4961c3b36b..105a2e9a03 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -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;