summaryrefslogtreecommitdiffstats
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-10-04 07:25:28 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-10-04 07:25:28 (GMT)
commit5a688dbf97f1537d3f2309bfe6be93dab2f10ce0 (patch)
tree669b73365df94fcb787c7dfe0edaf43e9e4a33d6 /Modules/_pickle.c
parent29f43f7368115c47c97acff02816a680c3ebd73e (diff)
parentffd41d9f101e31973b8713e884c95118fceb6f59 (diff)
downloadcpython-5a688dbf97f1537d3f2309bfe6be93dab2f10ce0.zip
cpython-5a688dbf97f1537d3f2309bfe6be93dab2f10ce0.tar.gz
cpython-5a688dbf97f1537d3f2309bfe6be93dab2f10ce0.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/_pickle.c')
-rw-r--r--Modules/_pickle.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 7bee1e1..0b10009 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -3134,10 +3134,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. */
@@ -3156,6 +3152,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;