summaryrefslogtreecommitdiffstats
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2013-11-24 10:41:05 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2013-11-24 10:41:05 (GMT)
commit4c05d3bc561dcdd70dd0d268fa769197334349a8 (patch)
treecb64c1535b23aa2904108d62f67a769ec415b974 /Modules/_pickle.c
parentd606ba7f5579a152d8826e10cdc528af2a5c0e10 (diff)
downloadcpython-4c05d3bc561dcdd70dd0d268fa769197334349a8.zip
cpython-4c05d3bc561dcdd70dd0d268fa769197334349a8.tar.gz
cpython-4c05d3bc561dcdd70dd0d268fa769197334349a8.tar.bz2
Make built-in methods picklable through the reduce protocol.
Diffstat (limited to 'Modules/_pickle.c')
-rw-r--r--Modules/_pickle.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 741cb8a..f0c918f 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -3514,34 +3514,6 @@ save_reduce(PicklerObject *self, PyObject *args, PyObject *obj)
}
static int
-save_method(PicklerObject *self, PyObject *obj)
-{
- PyObject *method_self = PyCFunction_GET_SELF(obj);
-
- if (method_self == NULL || PyModule_Check(method_self)) {
- return save_global(self, obj, NULL);
- }
- else {
- PyObject *builtins;
- PyObject *getattr;
- PyObject *reduce_value;
- int status = -1;
- _Py_IDENTIFIER(getattr);
-
- builtins = PyEval_GetBuiltins();
- getattr = _PyDict_GetItemId(builtins, &PyId_getattr);
- reduce_value = \
- Py_BuildValue("O(Os)", getattr, method_self,
- ((PyCFunctionObject *)obj)->m_ml->ml_name);
- if (reduce_value != NULL) {
- status = save_reduce(self, reduce_value, obj);
- Py_DECREF(reduce_value);
- }
- return status;
- }
-}
-
-static int
save(PicklerObject *self, PyObject *obj, int pers_save)
{
PyTypeObject *type;
@@ -3652,10 +3624,6 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
goto done;
}
}
- else if (type == &PyCFunction_Type) {
- status = save_method(self, obj);
- goto done;
- }
/* XXX: This part needs some unit tests. */