Actually, PyArg_ParseTuple() is a better call for this. It allows you to specify the method name: if (!PyArg_ParseTuple(args, ":close")) return NULL; Cheers,, -g On Sat, 3 Jun 2000, A.M. Kuchling wrote:
Update of /cvsroot/python/python/dist/src/Modules In directory slayer.i.sourceforge.net:/tmp/cvs-serv21410
Modified Files: mmapmodule.c Log Message: Add missing PyArg_NoArgs() calls to methods that didn't take arguments (Pointed out by Moshe Zadka)
Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.8 retrieving revision 2.9 diff -C2 -r2.8 -r2.9 *** mmapmodule.c 2000/05/03 23:44:32 2.8 --- mmapmodule.c 2000/06/03 19:41:42 2.9 *************** *** 2,6 **** / Author: Sam Rushing <rushing@nightmare.com> / Hacked for Unix by A.M. Kuchling <amk1@bigfoot.com> ! / $Id: mmapmodule.c,v 2.8 2000/05/03 23:44:32 guido Exp $
/ mmapmodule.cpp -- map a view of a file into memory --- 2,6 ---- / Author: Sam Rushing <rushing@nightmare.com> / Hacked for Unix by A.M. Kuchling <amk1@bigfoot.com> ! / $Id: mmapmodule.c,v 2.9 2000/06/03 19:41:42 akuchling Exp $
/ mmapmodule.cpp -- map a view of a file into memory *************** *** 76,79 **** --- 76,81 ---- mmap_close_method (mmap_object * self, PyObject * args) { + if (!PyArg_NoArgs(args)) + return NULL; #ifdef MS_WIN32 UnmapViewOfFile (self->data); *************** *** 119,122 **** --- 121,126 ---- char * where; CHECK_VALID(NULL); + if (!PyArg_NoArgs(args)) + return NULL; if (self->pos >= 0 && self->pos < self->size) { where = self->data + self->pos; *************** *** 132,136 **** static PyObject * mmap_read_line_method (mmap_object * self, ! PyObject * args) { char * start = self->data+self->pos; --- 136,140 ---- static PyObject * mmap_read_line_method (mmap_object * self, ! PyObject * args) { char * start = self->data+self->pos; *************** *** 140,143 **** --- 144,149 ----
CHECK_VALID(NULL); + if (!PyArg_NoArgs(args)) + return NULL;
eol = memchr(start, '\n', self->size - self->pos); *************** *** 154,158 **** static PyObject * mmap_read_method (mmap_object * self, ! PyObject * args) { long num_bytes; --- 160,164 ---- static PyObject * mmap_read_method (mmap_object * self, ! PyObject * args) { long num_bytes; *************** *** 226,230 **** static PyObject * mmap_write_byte_method (mmap_object * self, ! PyObject * args) { char value; --- 232,236 ---- static PyObject * mmap_write_byte_method (mmap_object * self, ! PyObject * args) { char value; *************** *** 242,248 **** static PyObject * mmap_size_method (mmap_object * self, ! PyObject * args) { CHECK_VALID(NULL);
#ifdef MS_WIN32 --- 248,256 ---- static PyObject * mmap_size_method (mmap_object * self, ! PyObject * args) { CHECK_VALID(NULL); + if (!PyArg_NoArgs(args)) + return NULL;
#ifdef MS_WIN32 *************** *** 347,350 **** --- 355,360 ---- { CHECK_VALID(NULL); + if (!PyArg_NoArgs(args)) + return NULL; return (Py_BuildValue ("l", self->pos) ); } *************** *** 463,470 ****
static int ! mmap_buffer_getreadbuf(self, index, ptr) ! mmap_object *self; ! int index; ! const void **ptr; { CHECK_VALID(-1); --- 473,477 ----
static int ! mmap_buffer_getreadbuf(mmap_object *self, int index, const void **ptr) { CHECK_VALID(-1); *************** *** 868,869 **** --- 875,877 ----
} +
_______________________________________________ Python-checkins mailing list Python-checkins@python.org http://www.python.org/mailman/listinfo/python-checkins
-- Greg Stein, http://www.lyra.org/