[Python-checkins] python/dist/src/Modules cPickle.c,2.150,2.151
loewis at users.sourceforge.net
loewis at users.sourceforge.net
Tue Jul 27 07:22:36 CEST 2004
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12675/Modules
Modified Files:
cPickle.c
Log Message:
Patch #995766: Keyword argument support in cPickle.
Index: cPickle.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v
retrieving revision 2.150
retrieving revision 2.151
diff -C2 -d -r2.150 -r2.151
*** cPickle.c 8 Jun 2004 18:52:52 -0000 2.150
--- cPickle.c 27 Jul 2004 05:22:33 -0000 2.151
***************
*** 2851,2861 ****
static PyObject *
! get_Pickler(PyObject *self, PyObject *args)
{
PyObject *file = NULL;
int proto = 0;
/* XXX
! * The documented signature is Pickler(file, proto=0), but this
* accepts Pickler() and Pickler(integer) too. The meaning then
* is clear as mud, undocumented, and not supported by pickle.py.
--- 2851,2862 ----
static PyObject *
! get_Pickler(PyObject *self, PyObject *args, PyObject *kwds)
{
+ static char *kwlist[] = {"file", "protocol", NULL};
PyObject *file = NULL;
int proto = 0;
/* XXX
! * The documented signature is Pickler(file, protocol=0), but this
* accepts Pickler() and Pickler(integer) too. The meaning then
* is clear as mud, undocumented, and not supported by pickle.py.
***************
*** 2866,2870 ****
PyErr_Clear();
proto = 0;
! if (!PyArg_ParseTuple(args, "O|i:Pickler", &file, &proto))
return NULL;
}
--- 2867,2872 ----
PyErr_Clear();
proto = 0;
! if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|i:Pickler",
! kwlist, &file, &proto))
return NULL;
}
***************
*** 5378,5390 ****
*/
! /* dump(obj, file, proto=0). */
static PyObject *
! cpm_dump(PyObject *self, PyObject *args)
{
PyObject *ob, *file, *res = NULL;
Picklerobject *pickler = 0;
int proto = 0;
! if (!( PyArg_ParseTuple(args, "OO|i", &ob, &file, &proto)))
goto finally;
--- 5380,5394 ----
*/
! /* dump(obj, file, protocol=0). */
static PyObject *
! cpm_dump(PyObject *self, PyObject *args, PyObject *kwds)
{
+ static char *kwlist[] = {"obj", "file", "protocol", NULL};
PyObject *ob, *file, *res = NULL;
Picklerobject *pickler = 0;
int proto = 0;
! if (!( PyArg_ParseTupleAndKeywords(args, kwds, "OO|i", kwlist,
! &ob, &file, &proto)))
goto finally;
***************
*** 5405,5417 ****
! /* dumps(obj, proto=0). */
static PyObject *
! cpm_dumps(PyObject *self, PyObject *args)
{
PyObject *ob, *file = 0, *res = NULL;
Picklerobject *pickler = 0;
int proto = 0;
! if (!( PyArg_ParseTuple(args, "O|i:dumps", &ob, &proto)))
goto finally;
--- 5409,5423 ----
! /* dumps(obj, protocol=0). */
static PyObject *
! cpm_dumps(PyObject *self, PyObject *args, PyObject *kwds)
{
+ static char *kwlist[] = {"obj", "protocol", NULL};
PyObject *ob, *file = 0, *res = NULL;
Picklerobject *pickler = 0;
int proto = 0;
! if (!( PyArg_ParseTupleAndKeywords(args, kwds, "O|i:dumps", kwlist,
! &ob, &proto)))
goto finally;
***************
*** 5514,5519 ****
static struct PyMethodDef cPickle_methods[] = {
! {"dump", (PyCFunction)cpm_dump, METH_VARARGS,
! PyDoc_STR("dump(object, file, proto=0) -- "
"Write an object in pickle format to the given file.\n"
"\n"
--- 5520,5525 ----
static struct PyMethodDef cPickle_methods[] = {
! {"dump", (PyCFunction)cpm_dump, METH_VARARGS | METH_KEYWORDS,
! PyDoc_STR("dump(obj, file, protocol=0) -- "
"Write an object in pickle format to the given file.\n"
"\n"
***************
*** 5521,5526 ****
},
! {"dumps", (PyCFunction)cpm_dumps, METH_VARARGS,
! PyDoc_STR("dumps(object, proto=0) -- "
"Return a string containing an object in pickle format.\n"
"\n"
--- 5527,5532 ----
},
! {"dumps", (PyCFunction)cpm_dumps, METH_VARARGS | METH_KEYWORDS,
! PyDoc_STR("dumps(obj, protocol=0) -- "
"Return a string containing an object in pickle format.\n"
"\n"
***************
*** 5534,5539 ****
PyDoc_STR("loads(string) -- Load a pickle from the given string")},
! {"Pickler", (PyCFunction)get_Pickler, METH_VARARGS,
! PyDoc_STR("Pickler(file, proto=0) -- Create a pickler.\n"
"\n"
"This takes a file-like object for writing a pickle data stream.\n"
--- 5540,5545 ----
PyDoc_STR("loads(string) -- Load a pickle from the given string")},
! {"Pickler", (PyCFunction)get_Pickler, METH_VARARGS | METH_KEYWORDS,
! PyDoc_STR("Pickler(file, protocol=0) -- Create a pickler.\n"
"\n"
"This takes a file-like object for writing a pickle data stream.\n"
More information about the Python-checkins
mailing list