[Python-checkins] CVS: python/dist/src/Modules arraymodule.c,2.35,2.36
Fred L. Drake
fdrake@weyr.cnri.reston.va.us
Fri, 3 Dec 1999 12:15:33 -0500 (EST)
Update of /projects/cvsroot/python/dist/src/Modules
In directory weyr:/home/fdrake/projects/python/Modules
Modified Files:
arraymodule.c
Log Message:
Correct the docstring for byteswap(); error noted by Bernhard Reiter
<bernhard@uwm.edu>.
Added a check that no parameters were passed to byteswap(); previously
allowed any parameters you happened to pass.
Index: arraymodule.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Modules/arraymodule.c,v
retrieving revision 2.35
retrieving revision 2.36
diff -u -C2 -r2.35 -r2.36
*** arraymodule.c 1999/08/27 20:33:52 2.35
--- arraymodule.c 1999/12/03 17:15:30 2.36
***************
*** 760,763 ****
--- 760,767 ----
char *p;
int i;
+
+ if (!PyArg_ParseTuple(args, ":byteswap"))
+ return NULL;
+
switch (self->ob_descr->itemsize) {
case 1:
***************
*** 806,813 ****
static char byteswap_doc [] =
! "byteswap(x)\n\
\n\
! Byteswap all items of the array. This is only supported for integer\n\
! values of x, which determines the size of the blocks swapped.";
static PyObject *
--- 810,817 ----
static char byteswap_doc [] =
! "byteswap()\n\
\n\
! Byteswap all items of the array. If the items in the array are not 1, 2,\n\
! 4, or 8 bytes in size, RuntimeError is raised.";
static PyObject *
***************
*** 1140,1144 ****
{"append", (PyCFunction)array_append, 0, append_doc},
{"buffer_info", (PyCFunction)array_buffer_info, 0, buffer_info_doc},
! {"byteswap", (PyCFunction)array_byteswap, 0, byteswap_doc},
/* {"count", (method)array_count},*/
{"fromfile", (PyCFunction)array_fromfile, 0, fromfile_doc},
--- 1144,1149 ----
{"append", (PyCFunction)array_append, 0, append_doc},
{"buffer_info", (PyCFunction)array_buffer_info, 0, buffer_info_doc},
! {"byteswap", (PyCFunction)array_byteswap, METH_VARARGS,
! byteswap_doc},
/* {"count", (method)array_count},*/
{"fromfile", (PyCFunction)array_fromfile, 0, fromfile_doc},