(original) (raw)

changeset: 31592:c6753db9c6af branch: legacy-trunk user: Christian Tismer tismer@stackless.com date: Thu Feb 26 16:21:45 2004 +0000 files: Modules/cPickle.c description: 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 -r 26a80f0af9f3 -r c6753db9c6af Modules/cPickle.c --- a/Modules/cPickle.c Thu Feb 26 15:22:17 2004 +0000 +++ b/Modules/cPickle.c Thu Feb 26 16:21:45 2004 +0000 @@ -2418,6 +2418,11 @@ 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; /tismer@stackless.com