Use PyArg_ParseTuple and specify the method names, following a suggestion
from Greg Stein
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 377002a..1f5e19a 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -75,7 +75,7 @@
static PyObject *
mmap_close_method (mmap_object * self, PyObject * args)
{
- if (!PyArg_NoArgs(args))
+ if (!PyArg_ParseTuple(args, ":close"))
return NULL;
#ifdef MS_WIN32
UnmapViewOfFile (self->data);
@@ -120,7 +120,7 @@
char value;
char * where;
CHECK_VALID(NULL);
- if (!PyArg_NoArgs(args))
+ if (!PyArg_ParseTuple(args, ":read_byte"))
return NULL;
if (self->pos >= 0 && self->pos < self->size) {
where = self->data + self->pos;
@@ -143,7 +143,7 @@
PyObject * result;
CHECK_VALID(NULL);
- if (!PyArg_NoArgs(args))
+ if (!PyArg_ParseTuple(args, ":readline"))
return NULL;
eol = memchr(start, '\n', self->size - self->pos);
@@ -250,7 +250,7 @@
PyObject * args)
{
CHECK_VALID(NULL);
- if (!PyArg_NoArgs(args))
+ if (!PyArg_ParseTuple(args, ":size"))
return NULL;
#ifdef MS_WIN32
@@ -354,7 +354,7 @@
mmap_tell_method (mmap_object * self, PyObject * args)
{
CHECK_VALID(NULL);
- if (!PyArg_NoArgs(args))
+ if (!PyArg_ParseTuple(args, ":tell"))
return NULL;
return (Py_BuildValue ("l", self->pos) );
}