summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2004-02-26 16:21:45 (GMT)
committerChristian Tismer <tismer@stackless.com>2004-02-26 16:21:45 (GMT)
commit2460c62152fe43f9da9381d09fd294f21e3640d7 (patch)
treee4fce117e13ae3cbbe7dbfa873e9136a0b994c50 /Modules
parentd594849c42b6141622f8e442e26b49e2df6ef4ff (diff)
downloadcpython-2460c62152fe43f9da9381d09fd294f21e3640d7.zip
cpython-2460c62152fe43f9da9381d09fd294f21e3640d7.tar.gz
cpython-2460c62152fe43f9da9381d09fd294f21e3640d7.tar.bz2
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 .
Diffstat (limited to 'Modules')
-rw-r--r--Modules/cPickle.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 4961c3b..105a2e9 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;