summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-10-04 07:23:04 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-10-04 07:23:04 (GMT)
commitffd41d9f101e31973b8713e884c95118fceb6f59 (patch)
tree3b549e20b5cf09244789f6e6f67a7dce2fad75b4 /Modules
parent1efb33a6823b94739e59d6e2fe92e8e703a7fc7d (diff)
downloadcpython-ffd41d9f101e31973b8713e884c95118fceb6f59.zip
cpython-ffd41d9f101e31973b8713e884c95118fceb6f59.tar.gz
cpython-ffd41d9f101e31973b8713e884c95118fceb6f59.tar.bz2
Issue #7689: Allow pickling of dynamically created classes when their
metaclass is registered with copyreg. Patch by Nicolas M. ThiƩry and Craig Citro.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_pickle.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 164d864..cb58349 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -3141,10 +3141,6 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
status = save_global(self, obj, NULL);
goto done;
}
- else if (PyType_IsSubtype(type, &PyType_Type)) {
- status = save_global(self, obj, NULL);
- goto done;
- }
/* XXX: This part needs some unit tests. */
@@ -3163,6 +3159,10 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
Py_INCREF(obj);
reduce_value = _Pickler_FastCall(self, reduce_func, obj);
}
+ else if (PyType_IsSubtype(type, &PyType_Type)) {
+ status = save_global(self, obj, NULL);
+ goto done;
+ }
else {
static PyObject *reduce_str = NULL;
static PyObject *reduce_ex_str = NULL;