mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #7689: Allow pickling of dynamically created classes when their
metaclass is registered with copyreg. Patch by Nicolas M. Thiéry and Craig Citro.
This commit is contained in:
commit
5a688dbf97
5 changed files with 40 additions and 13 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue