[Python-checkins] r46533 - in python/trunk: Modules/_bsddb.c Modules/_codecsmodule.c Modules/_hashopenssl.c Modules/_hotshot.c Modules/_localemodule.c Modules/_sre.c Modules/cPickle.c Modules/cjkcodecs/multibytecodec.c Modules/dbmmodule.c Modules/gdbmmodule.c Modules/linuxaudiodev.c Modules/mmapmodule.c Modules/ossaudiodev.c Modules/posixmodule.c Modules/pyexpat.c Modules/resource.c Modules/selectmodule.c Modules/sha256module.c Modules/sha512module.c Modules/shamodule.c Modules/socketmodule.c Modules/syslogmodule.c Modules/threadmodule.c Modules/timemodule.c Objects/genobject.c Python/sysmodule.c

georg.brandl python-checkins at python.org
Mon May 29 23:04:58 CEST 2006


Author: georg.brandl
Date: Mon May 29 23:04:52 2006
New Revision: 46533

Modified:
   python/trunk/Modules/_bsddb.c
   python/trunk/Modules/_codecsmodule.c
   python/trunk/Modules/_hashopenssl.c
   python/trunk/Modules/_hotshot.c
   python/trunk/Modules/_localemodule.c
   python/trunk/Modules/_sre.c
   python/trunk/Modules/cPickle.c
   python/trunk/Modules/cjkcodecs/multibytecodec.c
   python/trunk/Modules/dbmmodule.c
   python/trunk/Modules/gdbmmodule.c
   python/trunk/Modules/linuxaudiodev.c
   python/trunk/Modules/mmapmodule.c
   python/trunk/Modules/ossaudiodev.c
   python/trunk/Modules/posixmodule.c
   python/trunk/Modules/pyexpat.c
   python/trunk/Modules/resource.c
   python/trunk/Modules/selectmodule.c
   python/trunk/Modules/sha256module.c
   python/trunk/Modules/sha512module.c
   python/trunk/Modules/shamodule.c
   python/trunk/Modules/socketmodule.c
   python/trunk/Modules/syslogmodule.c
   python/trunk/Modules/threadmodule.c
   python/trunk/Modules/timemodule.c
   python/trunk/Objects/genobject.c
   python/trunk/Python/sysmodule.c
Log:
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.



Modified: python/trunk/Modules/_bsddb.c
==============================================================================
--- python/trunk/Modules/_bsddb.c	(original)
+++ python/trunk/Modules/_bsddb.c	Mon May 29 23:04:52 2006
@@ -1041,7 +1041,7 @@
     DBT key, data;
     DB_TXN *txn = NULL;
 
-    if (!PyArg_ParseTuple(args, "O|O:append", &dataobj, &txnobj))
+    if (!PyArg_UnpackTuple(args, "append", 1, 2, &dataobj, &txnobj))
         return NULL;
 
     CHECK_DB_NOT_CLOSED(self);
@@ -2895,7 +2895,7 @@
     PyObject* txnobj = NULL;
     DB_TXN *txn = NULL;
 
-    if (!PyArg_ParseTuple(args,"|O:keys", &txnobj))
+    if (!PyArg_UnpackTuple(args, "keys", 0, 1, &txnobj))
         return NULL;
     if (!checkTxnObj(txnobj, &txn))
         return NULL;
@@ -2909,7 +2909,7 @@
     PyObject* txnobj = NULL;
     DB_TXN *txn = NULL;
 
-    if (!PyArg_ParseTuple(args,"|O:items", &txnobj))
+    if (!PyArg_UnpackTuple(args, "items", 0, 1, &txnobj))
         return NULL;
     if (!checkTxnObj(txnobj, &txn))
         return NULL;
@@ -2923,7 +2923,7 @@
     PyObject* txnobj = NULL;
     DB_TXN *txn = NULL;
 
-    if (!PyArg_ParseTuple(args,"|O:values", &txnobj))
+    if (!PyArg_UnpackTuple(args, "values", 0, 1, &txnobj))
         return NULL;
     if (!checkTxnObj(txnobj, &txn))
         return NULL;

Modified: python/trunk/Modules/_codecsmodule.c
==============================================================================
--- python/trunk/Modules/_codecsmodule.c	(original)
+++ python/trunk/Modules/_codecsmodule.c	Mon May 29 23:04:52 2006
@@ -48,21 +48,12 @@
 a tuple of functions (encoder, decoder, stream_reader, stream_writer).");
 
 static
-PyObject *codec_register(PyObject *self, PyObject *args)
+PyObject *codec_register(PyObject *self, PyObject *search_function)
 {
-    PyObject *search_function;
-
-    if (!PyArg_ParseTuple(args, "O:register", &search_function))
-        goto onError;
-
     if (PyCodec_Register(search_function))
-	goto onError;
-
-    Py_INCREF(Py_None);
-    return Py_None;
+        return NULL;
 
- onError:
-    return NULL;
+    Py_RETURN_NONE;
 }
 
 PyDoc_STRVAR(lookup__doc__,
@@ -77,12 +68,9 @@
     char *encoding;
 
     if (!PyArg_ParseTuple(args, "s:lookup", &encoding))
-        goto onError;
+        return NULL;
 
     return _PyCodec_Lookup(encoding);
-
- onError:
-    return NULL;
 }
 
 PyDoc_STRVAR(encode__doc__,
@@ -116,13 +104,7 @@
 #endif
 
     /* Encode via the codec registry */
-    v = PyCodec_Encode(v, encoding, errors);
-    if (v == NULL)
-        goto onError;
-    return v;
-
- onError:
-    return NULL;
+    return PyCodec_Encode(v, encoding, errors);
 }
 
 PyDoc_STRVAR(decode__doc__,
@@ -156,13 +138,7 @@
 #endif
 
     /* Decode via the codec registry */
-    v = PyCodec_Decode(v, encoding, errors);
-    if (v == NULL)
-        goto onError;
-    return v;
-
- onError:
-    return NULL;
+    return PyCodec_Decode(v, encoding, errors);
 }
 
 /* --- Helpers ------------------------------------------------------------ */
@@ -171,22 +147,11 @@
 PyObject *codec_tuple(PyObject *unicode,
 		      Py_ssize_t len)
 {
-    PyObject *v,*w;
-
+    PyObject *v;
     if (unicode == NULL)
-	return NULL;
-    v = PyTuple_New(2);
-    if (v == NULL) {
-	Py_DECREF(unicode);
-	return NULL;
-    }
-    PyTuple_SET_ITEM(v,0,unicode);
-    w = PyInt_FromSsize_t(len);
-    if (w == NULL) {
-	Py_DECREF(v);
-	return NULL;
-    }
-    PyTuple_SET_ITEM(v,1,w);
+        return NULL;
+    v = Py_BuildValue("On", unicode, len);
+    Py_DECREF(unicode);
     return v;
 }
 
@@ -419,7 +384,7 @@
 					    final ? NULL : &consumed);
     if (unicode == NULL)
 	return NULL;
-    tuple = Py_BuildValue("Oii", unicode, consumed, byteorder);
+    tuple = Py_BuildValue("Oni", unicode, consumed, byteorder);
     Py_DECREF(unicode);
     return tuple;
 }
@@ -604,8 +569,8 @@
 	return NULL;
     v = codec_tuple(PyUnicode_EncodeUTF7(PyUnicode_AS_UNICODE(str),
 					 PyUnicode_GET_SIZE(str),
-                     0,
-                     0,
+					 0,
+					 0,
 					 errors),
 		    PyUnicode_GET_SIZE(str));
     Py_DECREF(str);
@@ -876,8 +841,7 @@
 	return NULL;
     if (PyCodec_RegisterError(name, handler))
         return NULL;
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 PyDoc_STRVAR(lookup_error__doc__,
@@ -899,7 +863,7 @@
 /* --- Module API --------------------------------------------------------- */
 
 static PyMethodDef _codecs_functions[] = {
-    {"register",		codec_register,			METH_VARARGS,
+    {"register",		codec_register,			METH_O,
         register__doc__},
     {"lookup",			codec_lookup, 			METH_VARARGS,
         lookup__doc__},

Modified: python/trunk/Modules/_hashopenssl.c
==============================================================================
--- python/trunk/Modules/_hashopenssl.c	(original)
+++ python/trunk/Modules/_hashopenssl.c	Mon May 29 23:04:52 2006
@@ -77,13 +77,10 @@
 PyDoc_STRVAR(EVP_copy__doc__, "Return a copy of the hash object.");
 
 static PyObject *
-EVP_copy(EVPobject *self, PyObject *args)
+EVP_copy(EVPobject *self, PyObject *unused)
 {
     EVPobject *newobj;
 
-    if (!PyArg_ParseTuple(args, ":copy"))
-        return NULL;
-
     if ( (newobj = newEVPobject(self->name))==NULL)
         return NULL;
 
@@ -95,16 +92,13 @@
 "Return the digest value as a string of binary data.");
 
 static PyObject *
-EVP_digest(EVPobject *self, PyObject *args)
+EVP_digest(EVPobject *self, PyObject *unused)
 {
     unsigned char digest[EVP_MAX_MD_SIZE];
     EVP_MD_CTX temp_ctx;
     PyObject *retval;
     unsigned int digest_size;
 
-    if (!PyArg_ParseTuple(args, ":digest"))
-        return NULL;
-
     EVP_MD_CTX_copy(&temp_ctx, &self->ctx);
     digest_size = EVP_MD_CTX_size(&temp_ctx);
     EVP_DigestFinal(&temp_ctx, digest, NULL);
@@ -118,7 +112,7 @@
 "Return the digest value as a string of hexadecimal digits.");
 
 static PyObject *
-EVP_hexdigest(EVPobject *self, PyObject *args)
+EVP_hexdigest(EVPobject *self, PyObject *unused)
 {
     unsigned char digest[EVP_MAX_MD_SIZE];
     EVP_MD_CTX temp_ctx;
@@ -126,9 +120,6 @@
     char *hex_digest;
     unsigned int i, j, digest_size;
 
-    if (!PyArg_ParseTuple(args, ":hexdigest"))
-        return NULL;
-
     /* Get the raw (binary) digest value */
     EVP_MD_CTX_copy(&temp_ctx, &self->ctx);
     digest_size = EVP_MD_CTX_size(&temp_ctx);
@@ -182,9 +173,9 @@
 
 static PyMethodDef EVP_methods[] = {
     {"update",	  (PyCFunction)EVP_update,    METH_VARARGS, EVP_update__doc__},
-    {"digest",	  (PyCFunction)EVP_digest,    METH_VARARGS, EVP_digest__doc__},
-    {"hexdigest", (PyCFunction)EVP_hexdigest, METH_VARARGS, EVP_hexdigest__doc__},
-    {"copy",	  (PyCFunction)EVP_copy,      METH_VARARGS, EVP_copy__doc__},
+    {"digest",	  (PyCFunction)EVP_digest,    METH_NOARGS,  EVP_digest__doc__},
+    {"hexdigest", (PyCFunction)EVP_hexdigest, METH_NOARGS,  EVP_hexdigest__doc__},
+    {"copy",	  (PyCFunction)EVP_copy,      METH_NOARGS,  EVP_copy__doc__},
     {NULL,	  NULL}		/* sentinel */
 };
 

Modified: python/trunk/Modules/_hotshot.c
==============================================================================
--- python/trunk/Modules/_hotshot.c	(original)
+++ python/trunk/Modules/_hotshot.c	Mon May 29 23:04:52 2006
@@ -1058,7 +1058,7 @@
     PyObject *callkw = NULL;
     PyObject *callable;
 
-    if (PyArg_ParseTuple(args, "O|OO:runcall",
+    if (PyArg_UnpackTuple(args, "runcall", 1, 3,
                          &callable, &callargs, &callkw)) {
         if (is_available(self)) {
             do_start(self);
@@ -1575,23 +1575,18 @@
 ;
 
 static PyObject *
-hotshot_resolution(PyObject *unused, PyObject *args)
+hotshot_resolution(PyObject *self, PyObject *unused)
 {
-    PyObject *result = NULL;
-
-    if (PyArg_ParseTuple(args, ":resolution")) {
-        if (timeofday_diff == 0) {
-            calibrate();
-            calibrate();
-            calibrate();
-        }
+    if (timeofday_diff == 0) {
+        calibrate();
+        calibrate();
+        calibrate();
+    }
 #ifdef MS_WINDOWS
-        result = Py_BuildValue("ii", timeofday_diff, frequency.LowPart);
+    return Py_BuildValue("ii", timeofday_diff, frequency.LowPart);
 #else
-        result = Py_BuildValue("ii", timeofday_diff, rusage_diff);
+    return Py_BuildValue("ii", timeofday_diff, rusage_diff);
 #endif
-    }
-    return result;
 }
 
 
@@ -1599,7 +1594,7 @@
     {"coverage",   hotshot_coverage,   METH_VARARGS, coverage__doc__},
     {"profiler",   hotshot_profiler,   METH_VARARGS, profiler__doc__},
     {"logreader",  hotshot_logreader,  METH_VARARGS, logreader__doc__},
-    {"resolution", hotshot_resolution, METH_VARARGS, resolution__doc__},
+    {"resolution", hotshot_resolution, METH_NOARGS,  resolution__doc__},
     {NULL, NULL}
 };
 

Modified: python/trunk/Modules/_localemodule.c
==============================================================================
--- python/trunk/Modules/_localemodule.c	(original)
+++ python/trunk/Modules/_localemodule.c	Mon May 29 23:04:52 2006
@@ -281,7 +281,7 @@
     wchar_t *ws1 = NULL, *ws2 = NULL;
     int rel1 = 0, rel2 = 0, len1, len2;
     
-    if (!PyArg_ParseTuple(args, "OO:strcoll", &os1, &os2))
+    if (!PyArg_UnpackTuple(args, "strcoll", 2, 2, &os1, &os2))
         return NULL;
     /* If both arguments are byte strings, use strcoll.  */
     if (PyString_Check(os1) && PyString_Check(os2))

Modified: python/trunk/Modules/_sre.c
==============================================================================
--- python/trunk/Modules/_sre.c	(original)
+++ python/trunk/Modules/_sre.c	Mon May 29 23:04:52 2006
@@ -2891,7 +2891,7 @@
     int index;
 
     PyObject* index_ = Py_False; /* zero */
-    if (!PyArg_ParseTuple(args, "|O:start", &index_))
+    if (!PyArg_UnpackTuple(args, "start", 0, 1, &index_))
         return NULL;
 
     index = match_getindex(self, index_);
@@ -2914,7 +2914,7 @@
     int index;
 
     PyObject* index_ = Py_False; /* zero */
-    if (!PyArg_ParseTuple(args, "|O:end", &index_))
+    if (!PyArg_UnpackTuple(args, "end", 0, 1, &index_))
         return NULL;
 
     index = match_getindex(self, index_);
@@ -2964,7 +2964,7 @@
     int index;
 
     PyObject* index_ = Py_False; /* zero */
-    if (!PyArg_ParseTuple(args, "|O:span", &index_))
+    if (!PyArg_UnpackTuple(args, "span", 0, 1, &index_))
         return NULL;
 
     index = match_getindex(self, index_);

Modified: python/trunk/Modules/cPickle.c
==============================================================================
--- python/trunk/Modules/cPickle.c	(original)
+++ python/trunk/Modules/cPickle.c	Mon May 29 23:04:52 2006
@@ -5110,29 +5110,23 @@
 
 
 static PyObject *
-Unpickler_load(Unpicklerobject *self, PyObject *args)
+Unpickler_load(Unpicklerobject *self, PyObject *unused)
 {
-	if (!( PyArg_ParseTuple(args, ":load")))
-		return NULL;
-
 	return load(self);
 }
 
 static PyObject *
-Unpickler_noload(Unpicklerobject *self, PyObject *args)
+Unpickler_noload(Unpicklerobject *self, PyObject *unused)
 {
-	if (!( PyArg_ParseTuple(args, ":noload")))
-		return NULL;
-
 	return noload(self);
 }
 
 
 static struct PyMethodDef Unpickler_methods[] = {
-  {"load",         (PyCFunction)Unpickler_load,   METH_VARARGS,
+  {"load",         (PyCFunction)Unpickler_load,   METH_NOARGS,
    PyDoc_STR("load() -- Load a pickle")
   },
-  {"noload",         (PyCFunction)Unpickler_noload,   METH_VARARGS,
+  {"noload",         (PyCFunction)Unpickler_noload,   METH_NOARGS,
    PyDoc_STR(
    "noload() -- not load a pickle, but go through most of the motions\n"
    "\n"
@@ -5214,12 +5208,8 @@
 
 
 static PyObject *
-get_Unpickler(PyObject *self, PyObject *args)
+get_Unpickler(PyObject *self, PyObject *file)
 {
-	PyObject *file;
-
-	if (!( PyArg_ParseTuple(args, "O:Unpickler", &file)))
-		return NULL;
 	return (PyObject *)newUnpicklerobject(file);
 }
 
@@ -5428,13 +5418,10 @@
 
 /* load(fileobj). */
 static PyObject *
-cpm_load(PyObject *self, PyObject *args)
+cpm_load(PyObject *self, PyObject *ob)
 {
 	Unpicklerobject *unpickler = 0;
-	PyObject *ob, *res = NULL;
-
-	if (!( PyArg_ParseTuple(args, "O:load", &ob)))
-		goto finally;
+	PyObject *res = NULL;
 
 	if (!( unpickler = newUnpicklerobject(ob)))
 		goto finally;
@@ -5519,7 +5506,7 @@
    "See the Pickler docstring for the meaning of optional argument proto.")
   },
 
-  {"load",         (PyCFunction)cpm_load,         METH_VARARGS,
+  {"load",         (PyCFunction)cpm_load,         METH_O,
    PyDoc_STR("load(file) -- Load a pickle from the given file")},
 
   {"loads",        (PyCFunction)cpm_loads,        METH_VARARGS,
@@ -5550,7 +5537,7 @@
    "object, or any other custom object that meets this interface.\n")
   },
 
-  {"Unpickler",    (PyCFunction)get_Unpickler,    METH_VARARGS,
+  {"Unpickler",    (PyCFunction)get_Unpickler,    METH_O,
    PyDoc_STR("Unpickler(file) -- Create an unpickler.")},
 
   { NULL, NULL }

Modified: python/trunk/Modules/cjkcodecs/multibytecodec.c
==============================================================================
--- python/trunk/Modules/cjkcodecs/multibytecodec.c	(original)
+++ python/trunk/Modules/cjkcodecs/multibytecodec.c	Mon May 29 23:04:52 2006
@@ -1302,7 +1302,7 @@
 	PyObject *sizeobj = NULL;
 	Py_ssize_t size;
 
-	if (!PyArg_ParseTuple(args, "|O:read", &sizeobj))
+	if (!PyArg_UnpackTuple(args, "read", 0, 1, &sizeobj))
 		return NULL;
 
 	if (sizeobj == Py_None || sizeobj == NULL)
@@ -1323,7 +1323,7 @@
 	PyObject *sizeobj = NULL;
 	Py_ssize_t size;
 
-	if (!PyArg_ParseTuple(args, "|O:readline", &sizeobj))
+	if (!PyArg_UnpackTuple(args, "readline", 0, 1, &sizeobj))
 		return NULL;
 
 	if (sizeobj == Py_None || sizeobj == NULL)
@@ -1344,7 +1344,7 @@
 	PyObject *sizehintobj = NULL, *r, *sr;
 	Py_ssize_t sizehint;
 
-	if (!PyArg_ParseTuple(args, "|O:readlines", &sizehintobj))
+	if (!PyArg_UnpackTuple(args, "readlines", 0, 1, &sizehintobj))
 		return NULL;
 
 	if (sizehintobj == Py_None || sizehintobj == NULL)
@@ -1532,13 +1532,8 @@
 }
 
 static PyObject *
-mbstreamwriter_write(MultibyteStreamWriterObject *self, PyObject *args)
+mbstreamwriter_write(MultibyteStreamWriterObject *self, PyObject *strobj)
 {
-	PyObject *strobj;
-
-	if (!PyArg_ParseTuple(args, "O:write", &strobj))
-		return NULL;
-
 	if (mbstreamwriter_iwrite(self, strobj))
 		return NULL;
 	else
@@ -1546,14 +1541,11 @@
 }
 
 static PyObject *
-mbstreamwriter_writelines(MultibyteStreamWriterObject *self, PyObject *args)
+mbstreamwriter_writelines(MultibyteStreamWriterObject *self, PyObject *lines)
 {
-	PyObject *lines, *strobj;
+	PyObject *strobj;
 	int i, r;
 
-	if (!PyArg_ParseTuple(args, "O:writelines", &lines))
-		return NULL;
-
 	if (!PySequence_Check(lines)) {
 		PyErr_SetString(PyExc_TypeError,
 				"arg must be a sequence object");
@@ -1676,9 +1668,9 @@
 
 static struct PyMethodDef mbstreamwriter_methods[] = {
 	{"write",	(PyCFunction)mbstreamwriter_write,
-			METH_VARARGS, NULL},
+			METH_O, NULL},
 	{"writelines",	(PyCFunction)mbstreamwriter_writelines,
-			METH_VARARGS, NULL},
+			METH_O, NULL},
 	{"reset",	(PyCFunction)mbstreamwriter_reset,
 			METH_NOARGS, NULL},
 	{NULL,		NULL},

Modified: python/trunk/Modules/dbmmodule.c
==============================================================================
--- python/trunk/Modules/dbmmodule.c	(original)
+++ python/trunk/Modules/dbmmodule.c	Mon May 29 23:04:52 2006
@@ -168,10 +168,8 @@
 };
 
 static PyObject *
-dbm__close(register dbmobject *dp, PyObject *args)
+dbm__close(register dbmobject *dp, PyObject *unused)
 {
-	if (!PyArg_ParseTuple(args, ":close"))
-		return NULL;
         if (dp->di_dbm)
 		dbm_close(dp->di_dbm);
 	dp->di_dbm = NULL;
@@ -180,14 +178,12 @@
 }
 
 static PyObject *
-dbm_keys(register dbmobject *dp, PyObject *args)
+dbm_keys(register dbmobject *dp, PyObject *unused)
 {
 	register PyObject *v, *item;
 	datum key;
 	int err;
 
-	if (!PyArg_ParseTuple(args, ":keys"))
-		return NULL;
         check_dbmobject_open(dp);
 	v = PyList_New(0);
 	if (v == NULL)
@@ -277,9 +273,9 @@
 }
 
 static PyMethodDef dbm_methods[] = {
-	{"close",	(PyCFunction)dbm__close,	METH_VARARGS,
+	{"close",	(PyCFunction)dbm__close,	METH_NOARGS,
 	 "close()\nClose the database."},
-	{"keys",	(PyCFunction)dbm_keys,		METH_VARARGS,
+	{"keys",	(PyCFunction)dbm_keys,		METH_NOARGS,
 	 "keys() -> list\nReturn a list of all keys in the database."},
 	{"has_key",	(PyCFunction)dbm_has_key,	METH_VARARGS,
 	 "has_key(key} -> boolean\nReturn true iff key is in the database."},

Modified: python/trunk/Modules/gdbmmodule.c
==============================================================================
--- python/trunk/Modules/gdbmmodule.c	(original)
+++ python/trunk/Modules/gdbmmodule.c	Mon May 29 23:04:52 2006
@@ -189,10 +189,8 @@
 Closes the database.");
 
 static PyObject *
-dbm_close(register dbmobject *dp, PyObject *args)
+dbm_close(register dbmobject *dp, PyObject *unused)
 {
-    if (!PyArg_ParseTuple(args, ":close"))
-        return NULL;
     if (dp->di_dbm)
         gdbm_close(dp->di_dbm);
     dp->di_dbm = NULL;
@@ -205,7 +203,7 @@
 Get a list of all keys in the database.");
 
 static PyObject *
-dbm_keys(register dbmobject *dp, PyObject *args)
+dbm_keys(register dbmobject *dp, PyObject *unused)
 {
     register PyObject *v, *item;
     datum key, nextkey;
@@ -215,9 +213,6 @@
         PyErr_BadInternalCall();
         return NULL;
     }
-    if (!PyArg_ParseTuple(args, ":keys"))
-        return NULL;
-
     check_dbmobject_open(dp);
 
     v = PyList_New(0);
@@ -269,13 +264,11 @@
 returns the starting key.");
 
 static PyObject *
-dbm_firstkey(register dbmobject *dp, PyObject *args)
+dbm_firstkey(register dbmobject *dp, PyObject *unused)
 {
     register PyObject *v;
     datum key;
 
-    if (!PyArg_ParseTuple(args, ":firstkey"))
-        return NULL;
     check_dbmobject_open(dp);
     key = gdbm_firstkey(dp->di_dbm);
     if (key.dptr) {
@@ -330,10 +323,8 @@
 kept and reused as new (key,value) pairs are added.");
 
 static PyObject *
-dbm_reorganize(register dbmobject *dp, PyObject *args)
+dbm_reorganize(register dbmobject *dp, PyObject *unused)
 {
-    if (!PyArg_ParseTuple(args, ":reorganize"))
-        return NULL;
     check_dbmobject_open(dp);
     errno = 0;
     if (gdbm_reorganize(dp->di_dbm) < 0) {
@@ -353,10 +344,8 @@
 any unwritten data to be written to the disk.");
 
 static PyObject *
-dbm_sync(register dbmobject *dp, PyObject *args)
+dbm_sync(register dbmobject *dp, PyObject *unused)
 {
-    if (!PyArg_ParseTuple(args, ":sync"))
-        return NULL;
     check_dbmobject_open(dp);
     gdbm_sync(dp->di_dbm);
     Py_INCREF(Py_None);
@@ -364,13 +353,13 @@
 }
 
 static PyMethodDef dbm_methods[] = {
-    {"close",	  (PyCFunction)dbm_close,   METH_VARARGS, dbm_close__doc__},
-    {"keys",	  (PyCFunction)dbm_keys,    METH_VARARGS, dbm_keys__doc__},
+    {"close",	  (PyCFunction)dbm_close,   METH_NOARGS, dbm_close__doc__},
+    {"keys",	  (PyCFunction)dbm_keys,    METH_NOARGS, dbm_keys__doc__},
     {"has_key",   (PyCFunction)dbm_has_key, METH_VARARGS, dbm_has_key__doc__},
-    {"firstkey",  (PyCFunction)dbm_firstkey,METH_VARARGS, dbm_firstkey__doc__},
+    {"firstkey",  (PyCFunction)dbm_firstkey,METH_NOARGS, dbm_firstkey__doc__},
     {"nextkey",	  (PyCFunction)dbm_nextkey, METH_VARARGS, dbm_nextkey__doc__},
-    {"reorganize",(PyCFunction)dbm_reorganize,METH_VARARGS, dbm_reorganize__doc__},
-    {"sync",      (PyCFunction)dbm_sync,    METH_VARARGS, dbm_sync__doc__},
+    {"reorganize",(PyCFunction)dbm_reorganize,METH_NOARGS, dbm_reorganize__doc__},
+    {"sync",      (PyCFunction)dbm_sync,    METH_NOARGS, dbm_sync__doc__},
     {NULL,		NULL}		/* sentinel */
 };
 

Modified: python/trunk/Modules/linuxaudiodev.c
==============================================================================
--- python/trunk/Modules/linuxaudiodev.c	(original)
+++ python/trunk/Modules/linuxaudiodev.c	Mon May 29 23:04:52 2006
@@ -219,24 +219,18 @@
 }
 
 static PyObject *
-lad_close(lad_t *self, PyObject *args)
+lad_close(lad_t *self, PyObject *unused)
 {
-    if (!PyArg_ParseTuple(args, ":close"))
-	return NULL;
-
     if (self->x_fd >= 0) {
         close(self->x_fd);
         self->x_fd = -1;
     }
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 static PyObject *
-lad_fileno(lad_t *self, PyObject *args)
+lad_fileno(lad_t *self, PyObject *unused)
 {
-    if (!PyArg_ParseTuple(args, ":fileno")) 
-	return NULL;
     return PyInt_FromLong(self->x_fd);
 }
 
@@ -341,13 +335,11 @@
 /* bufsize returns the size of the hardware audio buffer in number 
    of samples */
 static PyObject *
-lad_bufsize(lad_t *self, PyObject *args)
+lad_bufsize(lad_t *self, PyObject *unused)
 {
     audio_buf_info ai;
     int nchannels=0, ssize=0;
 
-    if (!PyArg_ParseTuple(args, ":bufsize")) return NULL;
-
     if (_ssize(self, &nchannels, &ssize) < 0 || !ssize || !nchannels) {
         PyErr_SetFromErrno(LinuxAudioError);
         return NULL;
@@ -362,14 +354,11 @@
 /* obufcount returns the number of samples that are available in the 
    hardware for playing */
 static PyObject *
-lad_obufcount(lad_t *self, PyObject *args)
+lad_obufcount(lad_t *self, PyObject *unused)
 {
     audio_buf_info ai;
     int nchannels=0, ssize=0;
 
-    if (!PyArg_ParseTuple(args, ":obufcount"))
-        return NULL;
-
     if (_ssize(self, &nchannels, &ssize) < 0 || !ssize || !nchannels) {
         PyErr_SetFromErrno(LinuxAudioError);
         return NULL;
@@ -385,14 +374,11 @@
 /* obufcount returns the number of samples that can be played without
    blocking */
 static PyObject *
-lad_obuffree(lad_t *self, PyObject *args)
+lad_obuffree(lad_t *self, PyObject *unused)
 {
     audio_buf_info ai;
     int nchannels=0, ssize=0;
 
-    if (!PyArg_ParseTuple(args, ":obuffree"))
-        return NULL;
-
     if (_ssize(self, &nchannels, &ssize) < 0 || !ssize || !nchannels) {
         PyErr_SetFromErrno(LinuxAudioError);
         return NULL;
@@ -406,27 +392,21 @@
 
 /* Flush the device */
 static PyObject *
-lad_flush(lad_t *self, PyObject *args)
+lad_flush(lad_t *self, PyObject *unused)
 {
-    if (!PyArg_ParseTuple(args, ":flush")) return NULL;
-
     if (ioctl(self->x_fd, SNDCTL_DSP_SYNC, NULL) == -1) {
         PyErr_SetFromErrno(LinuxAudioError);
         return NULL;
     }
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 static PyObject *
-lad_getptr(lad_t *self, PyObject *args)
+lad_getptr(lad_t *self, PyObject *unused)
 {
     count_info info;
     int req;
 
-    if (!PyArg_ParseTuple(args, ":getptr"))
-	return NULL;
-    
     if (self->x_mode == O_RDONLY)
 	req = SNDCTL_DSP_GETIPTR;
     else
@@ -443,12 +423,12 @@
     { "write",		(PyCFunction)lad_write, METH_VARARGS },
     { "setparameters",	(PyCFunction)lad_setparameters, METH_VARARGS },
     { "bufsize",	(PyCFunction)lad_bufsize, METH_VARARGS },
-    { "obufcount",	(PyCFunction)lad_obufcount, METH_VARARGS },
-    { "obuffree",	(PyCFunction)lad_obuffree, METH_VARARGS },
-    { "flush",		(PyCFunction)lad_flush, METH_VARARGS },
-    { "close",		(PyCFunction)lad_close, METH_VARARGS },
-    { "fileno",     	(PyCFunction)lad_fileno, METH_VARARGS },
-    { "getptr",         (PyCFunction)lad_getptr, METH_VARARGS },
+    { "obufcount",	(PyCFunction)lad_obufcount, METH_NOARGS },
+    { "obuffree",	(PyCFunction)lad_obuffree, METH_NOARGS },
+    { "flush",		(PyCFunction)lad_flush, METH_NOARGS },
+    { "close",		(PyCFunction)lad_close, METH_NOARGS },
+    { "fileno",     	(PyCFunction)lad_fileno, METH_NOARGS },
+    { "getptr",         (PyCFunction)lad_getptr, METH_NOARGS },
     { NULL,		NULL}		/* sentinel */
 };
 

Modified: python/trunk/Modules/mmapmodule.c
==============================================================================
--- python/trunk/Modules/mmapmodule.c	(original)
+++ python/trunk/Modules/mmapmodule.c	Mon May 29 23:04:52 2006
@@ -114,10 +114,8 @@
 }
 
 static PyObject *
-mmap_close_method(mmap_object *self, PyObject *args)
+mmap_close_method(mmap_object *self, PyObject *unused)
 {
-        if (!PyArg_ParseTuple(args, ":close"))
-		return NULL;
 #ifdef MS_WINDOWS
 	/* For each resource we maintain, we need to check
 	   the value is valid, and if so, free the resource
@@ -175,11 +173,9 @@
 
 static PyObject *
 mmap_read_byte_method(mmap_object *self,
-		      PyObject *args)
+		      PyObject *unused)
 {
 	CHECK_VALID(NULL);
-        if (!PyArg_ParseTuple(args, ":read_byte"))
-		return NULL;
 	if (self->pos < self->size) {
 	        char value = self->data[self->pos];
 		self->pos += 1;
@@ -192,7 +188,7 @@
 
 static PyObject *
 mmap_read_line_method(mmap_object *self,
-		      PyObject *args)
+		      PyObject *unused)
 {
 	char *start = self->data+self->pos;
 	char *eof = self->data+self->size;
@@ -200,8 +196,6 @@
 	PyObject *result;
 
 	CHECK_VALID(NULL);
-        if (!PyArg_ParseTuple(args, ":readline"))
-		return NULL;
 
 	eol = memchr(start, '\n', self->size - self->pos);
 	if (!eol)
@@ -332,11 +326,9 @@
 
 static PyObject *
 mmap_size_method(mmap_object *self,
-		 PyObject *args)
+		 PyObject *unused)
 {
 	CHECK_VALID(NULL);
-        if (!PyArg_ParseTuple(args, ":size"))
-		return NULL;
 
 #ifdef MS_WINDOWS
 	if (self->file_handle != INVALID_HANDLE_VALUE) {
@@ -472,11 +464,9 @@
 }
 
 static PyObject *
-mmap_tell_method(mmap_object *self, PyObject *args)
+mmap_tell_method(mmap_object *self, PyObject *unused)
 {
 	CHECK_VALID(NULL);
-        if (!PyArg_ParseTuple(args, ":tell"))
-		return NULL;
 	return PyInt_FromLong((long) self->pos);
 }
 
@@ -578,17 +568,17 @@
 }
 
 static struct PyMethodDef mmap_object_methods[] = {
-	{"close",	(PyCFunction) mmap_close_method,	METH_VARARGS},
+	{"close",	(PyCFunction) mmap_close_method,	METH_NOARGS},
 	{"find",	(PyCFunction) mmap_find_method,		METH_VARARGS},
 	{"flush",	(PyCFunction) mmap_flush_method,	METH_VARARGS},
 	{"move",	(PyCFunction) mmap_move_method,		METH_VARARGS},
 	{"read",	(PyCFunction) mmap_read_method,		METH_VARARGS},
-	{"read_byte",	(PyCFunction) mmap_read_byte_method,  	METH_VARARGS},
-	{"readline",	(PyCFunction) mmap_read_line_method,	METH_VARARGS},
+	{"read_byte",	(PyCFunction) mmap_read_byte_method,  	METH_NOARGS},
+	{"readline",	(PyCFunction) mmap_read_line_method,	METH_NOARGS},
 	{"resize",	(PyCFunction) mmap_resize_method,	METH_VARARGS},
 	{"seek",	(PyCFunction) mmap_seek_method,		METH_VARARGS},
-	{"size",	(PyCFunction) mmap_size_method,		METH_VARARGS},
-	{"tell",	(PyCFunction) mmap_tell_method,		METH_VARARGS},
+	{"size",	(PyCFunction) mmap_size_method,		METH_NOARGS},
+	{"tell",	(PyCFunction) mmap_tell_method,		METH_NOARGS},
 	{"write",	(PyCFunction) mmap_write_method,	METH_VARARGS},
 	{"write_byte",	(PyCFunction) mmap_write_byte_method,	METH_VARARGS},
 	{NULL,	   NULL}       /* sentinel */

Modified: python/trunk/Modules/ossaudiodev.c
==============================================================================
--- python/trunk/Modules/ossaudiodev.c	(original)
+++ python/trunk/Modules/ossaudiodev.c	Mon May 29 23:04:52 2006
@@ -296,12 +296,10 @@
  */
 
 static PyObject *
-oss_nonblock(oss_audio_t *self, PyObject *args)
+oss_nonblock(oss_audio_t *self, PyObject *unused)
 {
     /* Hmmm: it doesn't appear to be possible to return to blocking
        mode once we're in non-blocking mode! */
-    if (!PyArg_ParseTuple(args, ":nonblock"))
-        return NULL;
     if (ioctl(self->fd, SNDCTL_DSP_NONBLOCK, NULL) == -1)
         return PyErr_SetFromErrno(PyExc_IOError);
     Py_INCREF(Py_None);
@@ -315,11 +313,9 @@
 }
 
 static PyObject *
-oss_getfmts(oss_audio_t *self, PyObject *args)
+oss_getfmts(oss_audio_t *self, PyObject *unused)
 {
     int mask;
-    if (!PyArg_ParseTuple(args, ":getfmts"))
-        return NULL;
     if (ioctl(self->fd, SNDCTL_DSP_GETFMTS, &mask) == -1)
         return PyErr_SetFromErrno(PyExc_IOError);
     return PyInt_FromLong(mask);
@@ -459,11 +455,8 @@
 }
 
 static PyObject *
-oss_close(oss_audio_t *self, PyObject *args)
+oss_close(oss_audio_t *self, PyObject *unused)
 {
-    if (!PyArg_ParseTuple(args, ":close"))
-        return NULL;
-
     if (self->fd >= 0) {
         Py_BEGIN_ALLOW_THREADS
         close(self->fd);
@@ -475,10 +468,8 @@
 }
 
 static PyObject *
-oss_fileno(oss_audio_t *self, PyObject *args)
+oss_fileno(oss_audio_t *self, PyObject *unused)
 {
-    if (!PyArg_ParseTuple(args, ":fileno"))
-        return NULL;
     return PyInt_FromLong(self->fd);
 }
 
@@ -578,13 +569,11 @@
 /* bufsize returns the size of the hardware audio buffer in number
    of samples */
 static PyObject *
-oss_bufsize(oss_audio_t *self, PyObject *args)
+oss_bufsize(oss_audio_t *self, PyObject *unused)
 {
     audio_buf_info ai;
     int nchannels=0, ssize=0;
 
-    if (!PyArg_ParseTuple(args, ":bufsize")) return NULL;
-
     if (_ssize(self, &nchannels, &ssize) < 0 || !nchannels || !ssize) {
         PyErr_SetFromErrno(PyExc_IOError);
         return NULL;
@@ -599,14 +588,11 @@
 /* obufcount returns the number of samples that are available in the
    hardware for playing */
 static PyObject *
-oss_obufcount(oss_audio_t *self, PyObject *args)
+oss_obufcount(oss_audio_t *self, PyObject *unused)
 {
     audio_buf_info ai;
     int nchannels=0, ssize=0;
 
-    if (!PyArg_ParseTuple(args, ":obufcount"))
-        return NULL;
-
     if (_ssize(self, &nchannels, &ssize) < 0 || !nchannels || !ssize) {
         PyErr_SetFromErrno(PyExc_IOError);
         return NULL;
@@ -622,14 +608,11 @@
 /* obufcount returns the number of samples that can be played without
    blocking */
 static PyObject *
-oss_obuffree(oss_audio_t *self, PyObject *args)
+oss_obuffree(oss_audio_t *self, PyObject *unused)
 {
     audio_buf_info ai;
     int nchannels=0, ssize=0;
 
-    if (!PyArg_ParseTuple(args, ":obuffree"))
-        return NULL;
-
     if (_ssize(self, &nchannels, &ssize) < 0 || !nchannels || !ssize) {
         PyErr_SetFromErrno(PyExc_IOError);
         return NULL;
@@ -642,14 +625,11 @@
 }
 
 static PyObject *
-oss_getptr(oss_audio_t *self, PyObject *args)
+oss_getptr(oss_audio_t *self, PyObject *unused)
 {
     count_info info;
     int req;
 
-    if (!PyArg_ParseTuple(args, ":getptr"))
-        return NULL;
-
     if (self->mode == O_RDONLY)
         req = SNDCTL_DSP_GETIPTR;
     else
@@ -667,11 +647,8 @@
  */
 
 static PyObject *
-oss_mixer_close(oss_mixer_t *self, PyObject *args)
+oss_mixer_close(oss_mixer_t *self, PyObject *unused)
 {
-    if (!PyArg_ParseTuple(args, ":close"))
-        return NULL;
-
     if (self->fd >= 0) {
         close(self->fd);
         self->fd = -1;
@@ -681,10 +658,8 @@
 }
 
 static PyObject *
-oss_mixer_fileno(oss_mixer_t *self, PyObject *args)
+oss_mixer_fileno(oss_mixer_t *self, PyObject *unused)
 {
-    if (!PyArg_ParseTuple(args, ":fileno"))
-        return NULL;
     return PyInt_FromLong(self->fd);
 }
 
@@ -782,13 +757,13 @@
     { "read",           (PyCFunction)oss_read, METH_VARARGS },
     { "write",          (PyCFunction)oss_write, METH_VARARGS },
     { "writeall",       (PyCFunction)oss_writeall, METH_VARARGS },
-    { "close",          (PyCFunction)oss_close, METH_VARARGS },
-    { "fileno",         (PyCFunction)oss_fileno, METH_VARARGS },
+    { "close",          (PyCFunction)oss_close, METH_NOARGS },
+    { "fileno",         (PyCFunction)oss_fileno, METH_NOARGS },
 
     /* Simple ioctl wrappers */
-    { "nonblock",       (PyCFunction)oss_nonblock, METH_VARARGS },
+    { "nonblock",       (PyCFunction)oss_nonblock, METH_NOARGS },
     { "setfmt",         (PyCFunction)oss_setfmt, METH_VARARGS },
-    { "getfmts",        (PyCFunction)oss_getfmts, METH_VARARGS },
+    { "getfmts",        (PyCFunction)oss_getfmts, METH_NOARGS },
     { "channels",       (PyCFunction)oss_channels, METH_VARARGS },
     { "speed",          (PyCFunction)oss_speed, METH_VARARGS },
     { "sync",           (PyCFunction)oss_sync, METH_VARARGS },
@@ -797,10 +772,10 @@
 
     /* Convenience methods -- wrap a couple of ioctls together */
     { "setparameters",  (PyCFunction)oss_setparameters, METH_VARARGS },
-    { "bufsize",        (PyCFunction)oss_bufsize, METH_VARARGS },
-    { "obufcount",      (PyCFunction)oss_obufcount, METH_VARARGS },
-    { "obuffree",       (PyCFunction)oss_obuffree, METH_VARARGS },
-    { "getptr",         (PyCFunction)oss_getptr, METH_VARARGS },
+    { "bufsize",        (PyCFunction)oss_bufsize, METH_NOARGS },
+    { "obufcount",      (PyCFunction)oss_obufcount, METH_NOARGS },
+    { "obuffree",       (PyCFunction)oss_obuffree, METH_NOARGS },
+    { "getptr",         (PyCFunction)oss_getptr, METH_NOARGS },
 
     /* Aliases for backwards compatibility */
     { "flush",          (PyCFunction)oss_sync, METH_VARARGS },
@@ -810,8 +785,8 @@
 
 static PyMethodDef oss_mixer_methods[] = {
     /* Regular file method - OSS mixers are ioctl-only interface */
-    { "close",          (PyCFunction)oss_mixer_close, METH_VARARGS },
-    { "fileno",         (PyCFunction)oss_mixer_fileno, METH_VARARGS },
+    { "close",          (PyCFunction)oss_mixer_close, METH_NOARGS },
+    { "fileno",         (PyCFunction)oss_mixer_fileno, METH_NOARGS },
 
     /* Simple ioctl wrappers */
     { "controls",       (PyCFunction)oss_mixer_controls, METH_VARARGS },

Modified: python/trunk/Modules/posixmodule.c
==============================================================================
--- python/trunk/Modules/posixmodule.c	(original)
+++ python/trunk/Modules/posixmodule.c	Mon May 29 23:04:52 2006
@@ -5282,14 +5282,11 @@
 Set the groups of the current process to list.");
 
 static PyObject *
-posix_setgroups(PyObject *self, PyObject *args)
+posix_setgroups(PyObject *self, PyObject *groups)
 {
-	PyObject *groups;
 	int i, len;
         gid_t grouplist[MAX_GROUPS];
 
-	if (!PyArg_ParseTuple(args, "O:setgid", &groups))
-		return NULL;
 	if (!PySequence_Check(groups)) {
 		PyErr_SetString(PyExc_TypeError, "setgroups argument must be a sequence");
 		return NULL;
@@ -8020,7 +8017,7 @@
 	{"setgid",	posix_setgid, METH_VARARGS, posix_setgid__doc__},
 #endif /* HAVE_SETGID */
 #ifdef HAVE_SETGROUPS
-	{"setgroups",	posix_setgroups, METH_VARARGS, posix_setgroups__doc__},
+	{"setgroups",	posix_setgroups, METH_O, posix_setgroups__doc__},
 #endif /* HAVE_SETGROUPS */
 #ifdef HAVE_GETPGID
 	{"getpgid",	posix_getpgid, METH_VARARGS, posix_getpgid__doc__},

Modified: python/trunk/Modules/pyexpat.c
==============================================================================
--- python/trunk/Modules/pyexpat.c	(original)
+++ python/trunk/Modules/pyexpat.c	Mon May 29 23:04:52 2006
@@ -981,16 +981,12 @@
 Parse XML data from file-like object.");
 
 static PyObject *
-xmlparse_ParseFile(xmlparseobject *self, PyObject *args)
+xmlparse_ParseFile(xmlparseobject *self, PyObject *f)
 {
     int rv = 1;
-    PyObject *f;
     FILE *fp;
     PyObject *readmethod = NULL;
 
-    if (!PyArg_ParseTuple(args, "O:ParseFile", &f))
-        return NULL;
-
     if (PyFile_Check(f)) {
         fp = PyFile_AsFile(f);
     }
@@ -1062,11 +1058,8 @@
 Return base URL string for the parser.");
 
 static PyObject *
-xmlparse_GetBase(xmlparseobject *self, PyObject *args)
+xmlparse_GetBase(xmlparseobject *self, PyObject *unused)
 {
-    if (!PyArg_ParseTuple(args, ":GetBase"))
-        return NULL;
-
     return Py_BuildValue("z", XML_GetBase(self->itself));
 }
 
@@ -1077,29 +1070,21 @@
 for an element with many attributes), not all of the text may be available.");
 
 static PyObject *
-xmlparse_GetInputContext(xmlparseobject *self, PyObject *args)
+xmlparse_GetInputContext(xmlparseobject *self, PyObject *unused)
 {
-    PyObject *result = NULL;
-
-    if (PyArg_ParseTuple(args, ":GetInputContext")) {
-        if (self->in_callback) {
-            int offset, size;
-            const char *buffer
-                = XML_GetInputContext(self->itself, &offset, &size);
-
-            if (buffer != NULL)
-                result = PyString_FromStringAndSize(buffer + offset, size - offset);
-            else {
-                result = Py_None;
-                Py_INCREF(result);
-            }
-        }
-        else {
-            result = Py_None;
-            Py_INCREF(result);
-        }
+    if (self->in_callback) {
+        int offset, size;
+        const char *buffer
+            = XML_GetInputContext(self->itself, &offset, &size);
+
+        if (buffer != NULL)
+            return PyString_FromStringAndSize(buffer + offset,
+                                              size - offset);
+        else
+            Py_RETURN_NONE;
     }
-    return result;
+    else
+        Py_RETURN_NONE;
 }
 
 PyDoc_STRVAR(xmlparse_ExternalEntityParserCreate__doc__,
@@ -1228,7 +1213,7 @@
     PyObject *flagobj = NULL;
     XML_Bool flag = XML_TRUE;
     enum XML_Error rc;
-    if (!PyArg_ParseTuple(args, "|O:UseForeignDTD", &flagobj))
+    if (!PyArg_UnpackTuple(args, "UseForeignDTD", 0, 1, &flagobj))
         return NULL;
     if (flagobj != NULL)
         flag = PyObject_IsTrue(flagobj) ? XML_TRUE : XML_FALSE;
@@ -1245,17 +1230,17 @@
     {"Parse",	  (PyCFunction)xmlparse_Parse,
 		  METH_VARARGS,	xmlparse_Parse__doc__},
     {"ParseFile", (PyCFunction)xmlparse_ParseFile,
-		  METH_VARARGS,	xmlparse_ParseFile__doc__},
+		  METH_O,	xmlparse_ParseFile__doc__},
     {"SetBase",   (PyCFunction)xmlparse_SetBase,
 		  METH_VARARGS, xmlparse_SetBase__doc__},
     {"GetBase",   (PyCFunction)xmlparse_GetBase,
-		  METH_VARARGS, xmlparse_GetBase__doc__},
+		  METH_NOARGS, xmlparse_GetBase__doc__},
     {"ExternalEntityParserCreate", (PyCFunction)xmlparse_ExternalEntityParserCreate,
 	 	  METH_VARARGS, xmlparse_ExternalEntityParserCreate__doc__},
     {"SetParamEntityParsing", (PyCFunction)xmlparse_SetParamEntityParsing,
 		  METH_VARARGS, xmlparse_SetParamEntityParsing__doc__},
     {"GetInputContext", (PyCFunction)xmlparse_GetInputContext,
-		  METH_VARARGS, xmlparse_GetInputContext__doc__},
+		  METH_NOARGS, xmlparse_GetInputContext__doc__},
 #if XML_COMBINED_VERSION >= 19505
     {"UseForeignDTD", (PyCFunction)xmlparse_UseForeignDTD,
 		  METH_VARARGS, xmlparse_UseForeignDTD__doc__},

Modified: python/trunk/Modules/resource.c
==============================================================================
--- python/trunk/Modules/resource.c	(original)
+++ python/trunk/Modules/resource.c	Mon May 29 23:04:52 2006
@@ -194,12 +194,9 @@
 }
 
 static PyObject *
-resource_getpagesize(PyObject *self, PyObject *args)
+resource_getpagesize(PyObject *self, PyObject *unused)
 {
 	long pagesize = 0;
-	if (!PyArg_ParseTuple(args, ":getpagesize"))
-		return NULL;
-
 #if defined(HAVE_GETPAGESIZE)
 	pagesize = getpagesize();
 #elif defined(HAVE_SYSCONF)
@@ -221,7 +218,7 @@
 	{"getrusage",    resource_getrusage,   METH_VARARGS},
 	{"getrlimit",    resource_getrlimit,   METH_VARARGS},
 	{"setrlimit",    resource_setrlimit,   METH_VARARGS},
-	{"getpagesize",  resource_getpagesize, METH_VARARGS},
+	{"getpagesize",  resource_getpagesize, METH_NOARGS},
 	{NULL, NULL}			     /* sentinel */
 };
 

Modified: python/trunk/Modules/selectmodule.c
==============================================================================
--- python/trunk/Modules/selectmodule.c	(original)
+++ python/trunk/Modules/selectmodule.c	Mon May 29 23:04:52 2006
@@ -218,7 +218,7 @@
 	int n;
 
 	/* convert arguments */
-	if (!PyArg_ParseTuple(args, "OOO|O:select",
+	if (!PyArg_UnpackTuple(args, "select", 3, 4,
 			      &ifdlist, &ofdlist, &efdlist, &tout))
 		return NULL;
 
@@ -415,15 +415,11 @@
 Remove a file descriptor being tracked by the polling object.");
 
 static PyObject *
-poll_unregister(pollObject *self, PyObject *args) 
+poll_unregister(pollObject *self, PyObject *o) 
 {
-	PyObject *o, *key;
+	PyObject *key;
 	int fd;
 
-	if (!PyArg_ParseTuple(args, "O:unregister", &o)) {
-		return NULL;
-	}
-  
 	fd = PyObject_AsFileDescriptor( o );
 	if (fd == -1) 
 		return NULL;
@@ -459,7 +455,7 @@
 	int timeout = 0, poll_result, i, j;
 	PyObject *value = NULL, *num = NULL;
 
-	if (!PyArg_ParseTuple(args, "|O:poll", &tout)) {
+	if (!PyArg_UnpackTuple(args, "poll", 0, 1, &tout)) {
 		return NULL;
 	}
 
@@ -548,7 +544,7 @@
 	{"register",	(PyCFunction)poll_register,	
 	 METH_VARARGS,  poll_register_doc},
 	{"unregister",	(PyCFunction)poll_unregister,	
-	 METH_VARARGS,  poll_unregister_doc},
+	 METH_O,        poll_unregister_doc},
 	{"poll",	(PyCFunction)poll_poll,	
 	 METH_VARARGS,  poll_poll_doc},
 	{NULL,		NULL}		/* sentinel */
@@ -614,16 +610,9 @@
 unregistering file descriptors, and then polling them for I/O events.");
 
 static PyObject *
-select_poll(PyObject *self, PyObject *args)
+select_poll(PyObject *self, PyObject *unused)
 {
-	pollObject *rv;
-	
-	if (!PyArg_ParseTuple(args, ":poll"))
-		return NULL;
-	rv = newPollObject();
-	if ( rv == NULL )
-		return NULL;
-	return (PyObject *)rv;
+	return (PyObject *)newPollObject();
 }
 
 #ifdef __APPLE__
@@ -684,7 +673,7 @@
 static PyMethodDef select_methods[] = {
     {"select",	select_select, METH_VARARGS, select_doc},
 #if defined(HAVE_POLL) 
-    {"poll",    select_poll,   METH_VARARGS, poll_doc},
+    {"poll",    select_poll,   METH_NOARGS, poll_doc},
 #endif /* HAVE_POLL */
     {0,  	0},			     /* sentinel */
 };

Modified: python/trunk/Modules/sha256module.c
==============================================================================
--- python/trunk/Modules/sha256module.c	(original)
+++ python/trunk/Modules/sha256module.c	Mon May 29 23:04:52 2006
@@ -405,14 +405,10 @@
 PyDoc_STRVAR(SHA256_copy__doc__, "Return a copy of the hash object.");
 
 static PyObject *
-SHA256_copy(SHAobject *self, PyObject *args)
+SHA256_copy(SHAobject *self, PyObject *unused)
 {
     SHAobject *newobj;
 
-    if (!PyArg_ParseTuple(args, ":copy")) {
-        return NULL;
-    }
-
     if (((PyObject*)self)->ob_type == &SHA256type) {
         if ( (newobj = newSHA256object())==NULL)
             return NULL;
@@ -429,14 +425,11 @@
 "Return the digest value as a string of binary data.");
 
 static PyObject *
-SHA256_digest(SHAobject *self, PyObject *args)
+SHA256_digest(SHAobject *self, PyObject *unused)
 {
     unsigned char digest[SHA_DIGESTSIZE];
     SHAobject temp;
 
-    if (!PyArg_ParseTuple(args, ":digest"))
-        return NULL;
-
     SHAcopy(self, &temp);
     sha_final(digest, &temp);
     return PyString_FromStringAndSize((const char *)digest, self->digestsize);
@@ -446,7 +439,7 @@
 "Return the digest value as a string of hexadecimal digits.");
 
 static PyObject *
-SHA256_hexdigest(SHAobject *self, PyObject *args)
+SHA256_hexdigest(SHAobject *self, PyObject *unused)
 {
     unsigned char digest[SHA_DIGESTSIZE];
     SHAobject temp;
@@ -454,9 +447,6 @@
     char *hex_digest;
     int i, j;
 
-    if (!PyArg_ParseTuple(args, ":hexdigest"))
-        return NULL;
-
     /* Get the raw (binary) digest value */
     SHAcopy(self, &temp);
     sha_final(digest, &temp);
@@ -503,9 +493,9 @@
 }
 
 static PyMethodDef SHA_methods[] = {
-    {"copy",	  (PyCFunction)SHA256_copy,      METH_VARARGS, SHA256_copy__doc__},
-    {"digest",	  (PyCFunction)SHA256_digest,    METH_VARARGS, SHA256_digest__doc__},
-    {"hexdigest", (PyCFunction)SHA256_hexdigest, METH_VARARGS, SHA256_hexdigest__doc__},
+    {"copy",	  (PyCFunction)SHA256_copy,      METH_NOARGS,  SHA256_copy__doc__},
+    {"digest",	  (PyCFunction)SHA256_digest,    METH_NOARGS,  SHA256_digest__doc__},
+    {"hexdigest", (PyCFunction)SHA256_hexdigest, METH_NOARGS,  SHA256_hexdigest__doc__},
     {"update",	  (PyCFunction)SHA256_update,    METH_VARARGS, SHA256_update__doc__},
     {NULL,	  NULL}		/* sentinel */
 };

Modified: python/trunk/Modules/sha512module.c
==============================================================================
--- python/trunk/Modules/sha512module.c	(original)
+++ python/trunk/Modules/sha512module.c	Mon May 29 23:04:52 2006
@@ -471,14 +471,10 @@
 PyDoc_STRVAR(SHA512_copy__doc__, "Return a copy of the hash object.");
 
 static PyObject *
-SHA512_copy(SHAobject *self, PyObject *args)
+SHA512_copy(SHAobject *self, PyObject *unused)
 {
     SHAobject *newobj;
 
-    if (!PyArg_ParseTuple(args, ":copy")) {
-        return NULL;
-    }
-
     if (((PyObject*)self)->ob_type == &SHA512type) {
         if ( (newobj = newSHA512object())==NULL)
             return NULL;
@@ -495,14 +491,11 @@
 "Return the digest value as a string of binary data.");
 
 static PyObject *
-SHA512_digest(SHAobject *self, PyObject *args)
+SHA512_digest(SHAobject *self, PyObject *unused)
 {
     unsigned char digest[SHA_DIGESTSIZE];
     SHAobject temp;
 
-    if (!PyArg_ParseTuple(args, ":digest"))
-        return NULL;
-
     SHAcopy(self, &temp);
     sha512_final(digest, &temp);
     return PyString_FromStringAndSize((const char *)digest, self->digestsize);
@@ -512,7 +505,7 @@
 "Return the digest value as a string of hexadecimal digits.");
 
 static PyObject *
-SHA512_hexdigest(SHAobject *self, PyObject *args)
+SHA512_hexdigest(SHAobject *self, PyObject *unused)
 {
     unsigned char digest[SHA_DIGESTSIZE];
     SHAobject temp;
@@ -520,9 +513,6 @@
     char *hex_digest;
     int i, j;
 
-    if (!PyArg_ParseTuple(args, ":hexdigest"))
-        return NULL;
-
     /* Get the raw (binary) digest value */
     SHAcopy(self, &temp);
     sha512_final(digest, &temp);
@@ -538,7 +528,7 @@
     }
 
     /* Make hex version of the digest */
-    for(i=j=0; i<self->digestsize; i++) {
+    for (i=j=0; i<self->digestsize; i++) {
         char c;
         c = (digest[i] >> 4) & 0xf;
 	c = (c>9) ? c+'a'-10 : c + '0';
@@ -569,9 +559,9 @@
 }
 
 static PyMethodDef SHA_methods[] = {
-    {"copy",	  (PyCFunction)SHA512_copy,      METH_VARARGS, SHA512_copy__doc__},
-    {"digest",	  (PyCFunction)SHA512_digest,    METH_VARARGS, SHA512_digest__doc__},
-    {"hexdigest", (PyCFunction)SHA512_hexdigest, METH_VARARGS, SHA512_hexdigest__doc__},
+    {"copy",	  (PyCFunction)SHA512_copy,      METH_NOARGS, SHA512_copy__doc__},
+    {"digest",	  (PyCFunction)SHA512_digest,    METH_NOARGS, SHA512_digest__doc__},
+    {"hexdigest", (PyCFunction)SHA512_hexdigest, METH_NOARGS, SHA512_hexdigest__doc__},
     {"update",	  (PyCFunction)SHA512_update,    METH_VARARGS, SHA512_update__doc__},
     {NULL,	  NULL}		/* sentinel */
 };

Modified: python/trunk/Modules/shamodule.c
==============================================================================
--- python/trunk/Modules/shamodule.c	(original)
+++ python/trunk/Modules/shamodule.c	Mon May 29 23:04:52 2006
@@ -358,13 +358,10 @@
 PyDoc_STRVAR(SHA_copy__doc__, "Return a copy of the hashing object.");
 
 static PyObject *
-SHA_copy(SHAobject *self, PyObject *args)
+SHA_copy(SHAobject *self, PyObject *unused)
 {
     SHAobject *newobj;
 
-    if (!PyArg_ParseTuple(args, ":copy")) {
-        return NULL;
-    }
     if ( (newobj = newSHAobject())==NULL)
         return NULL;
 
@@ -376,14 +373,11 @@
 "Return the digest value as a string of binary data.");
 
 static PyObject *
-SHA_digest(SHAobject *self, PyObject *args)
+SHA_digest(SHAobject *self, PyObject *unused)
 {
     unsigned char digest[SHA_DIGESTSIZE];
     SHAobject temp;
 
-    if (!PyArg_ParseTuple(args, ":digest"))
-        return NULL;
-
     SHAcopy(self, &temp);
     sha_final(digest, &temp);
     return PyString_FromStringAndSize((const char *)digest, sizeof(digest));
@@ -393,7 +387,7 @@
 "Return the digest value as a string of hexadecimal digits.");
 
 static PyObject *
-SHA_hexdigest(SHAobject *self, PyObject *args)
+SHA_hexdigest(SHAobject *self, PyObject *unused)
 {
     unsigned char digest[SHA_DIGESTSIZE];
     SHAobject temp;
@@ -401,9 +395,6 @@
     char *hex_digest;
     int i, j;
 
-    if (!PyArg_ParseTuple(args, ":hexdigest"))
-        return NULL;
-
     /* Get the raw (binary) digest value */
     SHAcopy(self, &temp);
     sha_final(digest, &temp);
@@ -450,9 +441,9 @@
 }
 
 static PyMethodDef SHA_methods[] = {
-    {"copy",	  (PyCFunction)SHA_copy,      METH_VARARGS, SHA_copy__doc__},
-    {"digest",	  (PyCFunction)SHA_digest,    METH_VARARGS, SHA_digest__doc__},
-    {"hexdigest", (PyCFunction)SHA_hexdigest, METH_VARARGS, SHA_hexdigest__doc__},
+    {"copy",	  (PyCFunction)SHA_copy,      METH_NOARGS,  SHA_copy__doc__},
+    {"digest",	  (PyCFunction)SHA_digest,    METH_NOARGS,  SHA_digest__doc__},
+    {"hexdigest", (PyCFunction)SHA_hexdigest, METH_NOARGS,  SHA_hexdigest__doc__},
     {"update",	  (PyCFunction)SHA_update,    METH_VARARGS, SHA_update__doc__},
     {NULL,	  NULL}		/* sentinel */
 };

Modified: python/trunk/Modules/socketmodule.c
==============================================================================
--- python/trunk/Modules/socketmodule.c	(original)
+++ python/trunk/Modules/socketmodule.c	Mon May 29 23:04:52 2006
@@ -2889,12 +2889,10 @@
 
 /*ARGSUSED*/
 static PyObject *
-socket_gethostname(PyObject *self, PyObject *args)
+socket_gethostname(PyObject *self, PyObject *unused)
 {
 	char buf[1024];
 	int res;
-	if (!PyArg_ParseTuple(args, ":gethostname"))
-		return NULL;
 	Py_BEGIN_ALLOW_THREADS
 	res = gethostname(buf, (int) sizeof buf - 1);
 	Py_END_ALLOW_THREADS
@@ -3986,13 +3984,13 @@
 	{"gethostbyaddr",	socket_gethostbyaddr,
 	 METH_VARARGS, gethostbyaddr_doc},
 	{"gethostname",		socket_gethostname,
-	 METH_VARARGS, gethostname_doc},
+	 METH_NOARGS,  gethostname_doc},
 	{"getservbyname",	socket_getservbyname,
 	 METH_VARARGS, getservbyname_doc},
 	{"getservbyport",	socket_getservbyport,
 	 METH_VARARGS, getservbyport_doc},
 	{"getprotobyname",	socket_getprotobyname,
-	 METH_VARARGS,getprotobyname_doc},
+	 METH_VARARGS, getprotobyname_doc},
 #ifndef NO_DUP
 	{"fromfd",		socket_fromfd,
 	 METH_VARARGS, fromfd_doc},

Modified: python/trunk/Modules/syslogmodule.c
==============================================================================
--- python/trunk/Modules/syslogmodule.c	(original)
+++ python/trunk/Modules/syslogmodule.c	Mon May 29 23:04:52 2006
@@ -98,10 +98,8 @@
 }
 
 static PyObject * 
-syslog_closelog(PyObject *self, PyObject *args)
+syslog_closelog(PyObject *self, PyObject *unused)
 {
-	if (!PyArg_ParseTuple(args, ":closelog"))
-		return NULL;
 	closelog();
 	Py_XDECREF(S_ident_o);
 	S_ident_o = NULL;
@@ -146,7 +144,7 @@
 
 static PyMethodDef syslog_methods[] = {
 	{"openlog",	syslog_openlog,		METH_VARARGS},
-	{"closelog",	syslog_closelog,	METH_VARARGS},
+	{"closelog",	syslog_closelog,	METH_NOARGS},
 	{"syslog",	syslog_syslog,		METH_VARARGS},
 	{"setlogmask",	syslog_setlogmask,	METH_VARARGS},
 	{"LOG_MASK",	syslog_log_mask,	METH_VARARGS},

Modified: python/trunk/Modules/threadmodule.c
==============================================================================
--- python/trunk/Modules/threadmodule.c	(original)
+++ python/trunk/Modules/threadmodule.c	Mon May 29 23:04:52 2006
@@ -456,7 +456,8 @@
 	struct bootstate *boot;
 	long ident;
 
-	if (!PyArg_ParseTuple(fargs, "OO|O:start_new_thread", &func, &args, &keyw))
+	if (!PyArg_UnpackTuple(fargs, "start_new_thread", 2, 3,
+		               &func, &args, &keyw))
 		return NULL;
 	if (!PyCallable_Check(func)) {
 		PyErr_SetString(PyExc_TypeError,

Modified: python/trunk/Modules/timemodule.c
==============================================================================
--- python/trunk/Modules/timemodule.c	(original)
+++ python/trunk/Modules/timemodule.c	Mon May 29 23:04:52 2006
@@ -123,11 +123,9 @@
 }
 
 static PyObject *
-time_time(PyObject *self, PyObject *args)
+time_time(PyObject *self, PyObject *unused)
 {
 	double secs;
-	if (!PyArg_ParseTuple(args, ":time"))
-		return NULL;
 	secs = floattime();
 	if (secs == 0.0) {
 		PyErr_SetFromErrno(PyExc_IOError);
@@ -153,10 +151,8 @@
 #endif
 
 static PyObject *
-time_clock(PyObject *self, PyObject *args)
+time_clock(PyObject *self, PyObject *unused)
 {
-	if (!PyArg_ParseTuple(args, ":clock"))
-		return NULL;
 	return PyFloat_FromDouble(((double)clock()) / CLOCKS_PER_SEC);
 }
 #endif /* HAVE_CLOCK */
@@ -164,16 +160,13 @@
 #if defined(MS_WINDOWS) && !defined(__BORLANDC__)
 /* Due to Mark Hammond and Tim Peters */
 static PyObject *
-time_clock(PyObject *self, PyObject *args)
+time_clock(PyObject *self, PyObject *unused)
 {
 	static LARGE_INTEGER ctrStart;
 	static double divisor = 0.0;
 	LARGE_INTEGER now;
 	double diff;
 
-	if (!PyArg_ParseTuple(args, ":clock"))
-		return NULL;
-
 	if (divisor == 0.0) {
 		LARGE_INTEGER freq;
 		QueryPerformanceCounter(&ctrStart);
@@ -509,7 +502,7 @@
 	PyObject *tup = NULL;
 	struct tm buf;
 	char *p;
-	if (!PyArg_ParseTuple(args, "|O:asctime", &tup))
+	if (!PyArg_UnpackTuple(args, "asctime", 0, 1, &tup))
 		return NULL;
 	if (tup == NULL) {
 		time_t tt = time(NULL);
@@ -536,7 +529,7 @@
 	time_t tt;
 	char *p;
 
-	if (!PyArg_ParseTuple(args, "|O:ctime", &ot))
+	if (!PyArg_UnpackTuple(args, "ctime", 0, 1, &ot))
 		return NULL;
 	if (ot == NULL || ot == Py_None)
 		tt = time(NULL);
@@ -567,13 +560,10 @@
 
 #ifdef HAVE_MKTIME
 static PyObject *
-time_mktime(PyObject *self, PyObject *args)
+time_mktime(PyObject *self, PyObject *tup)
 {
-	PyObject *tup;
 	struct tm buf;
 	time_t tt;
-	if (!PyArg_ParseTuple(args, "O:mktime", &tup))
-		return NULL;
 	tt = time(&tt);
 	buf = *localtime(&tt);
 	if (!gettmarg(tup, &buf))
@@ -597,13 +587,10 @@
 void inittimezone(PyObject *module);
 
 static PyObject *
-time_tzset(PyObject *self, PyObject *args)
+time_tzset(PyObject *self, PyObject *unused)
 {
 	PyObject* m;
 
-	if (!PyArg_ParseTuple(args, ":tzset"))
-		return NULL;
-
 	m = PyImport_ImportModule("time");
 	if (m == NULL) {
 	    return NULL;
@@ -722,9 +709,9 @@
 
 
 static PyMethodDef time_methods[] = {
-	{"time",	time_time, METH_VARARGS, time_doc},
+	{"time",	time_time, METH_NOARGS, time_doc},
 #ifdef HAVE_CLOCK
-	{"clock",	time_clock, METH_VARARGS, clock_doc},
+	{"clock",	time_clock, METH_NOARGS, clock_doc},
 #endif
 	{"sleep",	time_sleep, METH_VARARGS, sleep_doc},
 	{"gmtime",	time_gmtime, METH_VARARGS, gmtime_doc},
@@ -732,14 +719,14 @@
 	{"asctime",	time_asctime, METH_VARARGS, asctime_doc},
 	{"ctime",	time_ctime, METH_VARARGS, ctime_doc},
 #ifdef HAVE_MKTIME
-	{"mktime",	time_mktime, METH_VARARGS, mktime_doc},
+	{"mktime",	time_mktime, METH_O, mktime_doc},
 #endif
 #ifdef HAVE_STRFTIME
 	{"strftime",	time_strftime, METH_VARARGS, strftime_doc},
 #endif
 	{"strptime",	time_strptime, METH_VARARGS, strptime_doc},
 #ifdef HAVE_WORKING_TZSET
-	{"tzset",	time_tzset, METH_VARARGS, tzset_doc},
+	{"tzset",	time_tzset, METH_NOARGS, tzset_doc},
 #endif
 	{NULL,		NULL}		/* sentinel */
 };

Modified: python/trunk/Objects/genobject.c
==============================================================================
--- python/trunk/Objects/genobject.c	(original)
+++ python/trunk/Objects/genobject.c	Mon May 29 23:04:52 2006
@@ -216,7 +216,7 @@
 	PyObject *tb = NULL;
 	PyObject *val = NULL;
 
-	if (!PyArg_ParseTuple(args, "O|OO:throw", &typ, &val, &tb))
+	if (!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb))
 		return NULL;
 
 	/* First, check the traceback argument, replacing None with

Modified: python/trunk/Python/sysmodule.c
==============================================================================
--- python/trunk/Python/sysmodule.c	(original)
+++ python/trunk/Python/sysmodule.c	Mon May 29 23:04:52 2006
@@ -200,7 +200,7 @@
 sys_exit(PyObject *self, PyObject *args)
 {
 	PyObject *exit_code = 0;
-	if (!PyArg_ParseTuple(args, "|O:exit", &exit_code))
+	if (!PyArg_UnpackTuple(args, "exit", 0, 1, &exit_code))
 		return NULL;
 	/* Raise SystemExit so callers may catch it or clean up. */
 	PyErr_SetObject(PyExc_SystemExit, exit_code);
@@ -672,7 +672,7 @@
 sys_call_tracing(PyObject *self, PyObject *args)
 {
 	PyObject *func, *funcargs;
-	if (!PyArg_ParseTuple(args, "OO:call_tracing", &func, &funcargs))
+	if (!PyArg_UnpackTuple(args, "call_tracing", 2, 2, &func, &funcargs))
 		return NULL;
 	return _PyEval_CallTracing(func, funcargs);
 }


More information about the Python-checkins mailing list