summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-05-29 21:04:52 +0000
committerGeorg Brandl <georg@python.org>2006-05-29 21:04:52 +0000
commit96a8c3954cbdb186bc567a490dad8987508ce268 (patch)
tree4d6516790abcd566c43418e4c9b02e9c52cf9f2f
parentfd9a4b19e9c77e9ccc3e7fcb57051cf160c0df6d (diff)
downloadcpython-git-96a8c3954cbdb186bc567a490dad8987508ce268.tar.gz
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
-rw-r--r--Modules/_bsddb.c8
-rw-r--r--Modules/_codecsmodule.c66
-rw-r--r--Modules/_hashopenssl.c21
-rw-r--r--Modules/_hotshot.c25
-rw-r--r--Modules/_localemodule.c2
-rw-r--r--Modules/_sre.c6
-rw-r--r--Modules/cPickle.c31
-rw-r--r--Modules/cjkcodecs/multibytecodec.c24
-rw-r--r--Modules/dbmmodule.c12
-rw-r--r--Modules/gdbmmodule.c31
-rw-r--r--Modules/linuxaudiodev.c50
-rw-r--r--Modules/mmapmodule.c30
-rw-r--r--Modules/ossaudiodev.c65
-rw-r--r--Modules/posixmodule.c7
-rw-r--r--Modules/pyexpat.c53
-rw-r--r--Modules/resource.c7
-rw-r--r--Modules/selectmodule.c27
-rw-r--r--Modules/sha256module.c22
-rw-r--r--Modules/sha512module.c24
-rw-r--r--Modules/shamodule.c21
-rw-r--r--Modules/socketmodule.c8
-rw-r--r--Modules/syslogmodule.c6
-rw-r--r--Modules/threadmodule.c3
-rw-r--r--Modules/timemodule.c35
-rw-r--r--Objects/genobject.c2
-rw-r--r--Python/sysmodule.c4
26 files changed, 186 insertions, 404 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index 777204687f..c8edaa0609 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -1041,7 +1041,7 @@ DB_append(DBObject* self, PyObject* args)
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 @@ DB_keys(DBObject* self, PyObject* args)
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 @@ DB_items(DBObject* self, PyObject* args)
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 @@ DB_values(DBObject* self, PyObject* args)
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;
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c
index d8d23c4050..080fa74c10 100644
--- a/Modules/_codecsmodule.c
+++ b/Modules/_codecsmodule.c
@@ -48,21 +48,12 @@ one argument, the encoding name in all lower case letters, and return\n\
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 @@ PyObject *codec_lookup(PyObject *self, PyObject *args)
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 @@ codec_encode(PyObject *self, PyObject *args)
#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 @@ codec_decode(PyObject *self, PyObject *args)
#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 @@ static
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 @@ utf_16_ex_decode(PyObject *self,
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 @@ utf_7_encode(PyObject *self,
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 @@ static PyObject *register_error(PyObject *self, PyObject *args)
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 @@ static PyObject *lookup_error(PyObject *self, PyObject *args)
/* --- 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__},
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index a7d627b2c9..859644fc70 100644
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -77,13 +77,10 @@ EVP_dealloc(PyObject *ptr)
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 @@ PyDoc_STRVAR(EVP_digest__doc__,
"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 @@ PyDoc_STRVAR(EVP_hexdigest__doc__,
"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 @@ EVP_hexdigest(EVPobject *self, PyObject *args)
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 @@ EVP_update(EVPobject *self, PyObject *args)
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 */
};
diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c
index 3ad0a9ef36..5a81bfbaaf 100644
--- a/Modules/_hotshot.c
+++ b/Modules/_hotshot.c
@@ -1058,7 +1058,7 @@ profiler_runcall(ProfilerObject *self, PyObject *args)
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 @@ PyDoc_STR(
;
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 @@ static PyMethodDef functions[] = {
{"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}
};
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 58beb5c303..c016cd7341 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -281,7 +281,7 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
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))
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 1b0fbc8f0e..4d7b4fcc27 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -2891,7 +2891,7 @@ match_start(MatchObject* self, PyObject* args)
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 @@ match_end(MatchObject* self, PyObject* args)
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 @@ match_span(MatchObject* self, PyObject* args)
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_);
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 85fd459318..0d293627af 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -5110,29 +5110,23 @@ noload(Unpicklerobject *self)
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 @@ newUnpicklerobject(PyObject *f)
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 @@ cpm_dumps(PyObject *self, PyObject *args, PyObject *kwds)
/* 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 @@ static struct PyMethodDef cPickle_methods[] = {
"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 @@ static struct PyMethodDef cPickle_methods[] = {
"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 }
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 7e6aedc037..7c6b989355 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -1302,7 +1302,7 @@ mbstreamreader_read(MultibyteStreamReaderObject *self, PyObject *args)
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 @@ mbstreamreader_readline(MultibyteStreamReaderObject *self, PyObject *args)
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 @@ mbstreamreader_readlines(MultibyteStreamReaderObject *self, PyObject *args)
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 @@ mbstreamwriter_iwrite(MultibyteStreamWriterObject *self,
}
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 @@ mbstreamwriter_write(MultibyteStreamWriterObject *self, PyObject *args)
}
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 @@ mbstreamwriter_dealloc(MultibyteStreamWriterObject *self)
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},
diff --git a/Modules/dbmmodule.c b/Modules/dbmmodule.c
index 8bfbbcda45..9086c84770 100644
--- a/Modules/dbmmodule.c
+++ b/Modules/dbmmodule.c
@@ -168,10 +168,8 @@ static PyMappingMethods dbm_as_mapping = {
};
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 @@ dbm__close(register dbmobject *dp, PyObject *args)
}
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 @@ dbm_setdefault(register dbmobject *dp, PyObject *args)
}
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."},
diff --git a/Modules/gdbmmodule.c b/Modules/gdbmmodule.c
index 76d54f820b..cfc6abc37f 100644
--- a/Modules/gdbmmodule.c
+++ b/Modules/gdbmmodule.c
@@ -189,10 +189,8 @@ PyDoc_STRVAR(dbm_close__doc__,
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 @@ PyDoc_STRVAR(dbm_keys__doc__,
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 @@ dbm_keys(register dbmobject *dp, PyObject *args)
PyErr_BadInternalCall();
return NULL;
}
- if (!PyArg_ParseTuple(args, ":keys"))
- return NULL;
-
check_dbmobject_open(dp);
v = PyList_New(0);
@@ -269,13 +264,11 @@ hash values, and won't be sorted by the key values. This method\n\
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 @@ by using this reorganization; otherwise, deleted file space will be\n\
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 @@ When the database has been opened in fast mode, this method forces\n\
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 @@ dbm_sync(register dbmobject *dp, PyObject *args)
}
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 */
};
diff --git a/Modules/linuxaudiodev.c b/Modules/linuxaudiodev.c
index 769451af85..c1c7363c83 100644
--- a/Modules/linuxaudiodev.c
+++ b/Modules/linuxaudiodev.c
@@ -219,24 +219,18 @@ lad_write(lad_t *self, PyObject *args)
}
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 @@ _ssize(lad_t *self, int *nchannels, int *ssize)
/* 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 @@ lad_bufsize(lad_t *self, PyObject *args)
/* 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 @@ lad_obufcount(lad_t *self, PyObject *args)
/* 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 @@ lad_obuffree(lad_t *self, PyObject *args)
/* 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 @@ static PyMethodDef lad_methods[] = {
{ "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 */
};
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 2e74e37ff2..19970c9fb6 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -114,10 +114,8 @@ mmap_object_dealloc(mmap_object *m_obj)
}
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 @@ do { \
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 @@ mmap_read_byte_method(mmap_object *self,
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 @@ mmap_read_line_method(mmap_object *self,
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 @@ mmap_write_byte_method(mmap_object *self,
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 @@ mmap_resize_method(mmap_object *self,
}
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 @@ mmap_move_method(mmap_object *self, PyObject *args)
}
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 */
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 563620cbea..9716838ba2 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -296,12 +296,10 @@ _do_ioctl_0(int fd, PyObject *args, char *fname, int cmd)
*/
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 @@ oss_setfmt(oss_audio_t *self, PyObject *args)
}
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 @@ oss_writeall(oss_audio_t *self, PyObject *args)
}
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 @@ oss_close(oss_audio_t *self, PyObject *args)
}
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 @@ _ssize(oss_audio_t *self, int *nchannels, int *ssize)
/* 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 @@ oss_bufsize(oss_audio_t *self, PyObject *args)
/* 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 @@ oss_obufcount(oss_audio_t *self, PyObject *args)
/* 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 @@ oss_obuffree(oss_audio_t *self, PyObject *args)
}
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 @@ oss_getptr(oss_audio_t *self, PyObject *args)
*/
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 @@ oss_mixer_close(oss_mixer_t *self, PyObject *args)
}
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 @@ static PyMethodDef oss_methods[] = {
{ "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 @@ static PyMethodDef oss_methods[] = {
/* 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_methods[] = {
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 },
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 7f0a2618ef..c0280de81e 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -5282,14 +5282,11 @@ PyDoc_STRVAR(posix_setgroups__doc__,
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 @@ static PyMethodDef posix_methods[] = {
{"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__},
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index fe50e361f6..8a10babde3 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -981,16 +981,12 @@ PyDoc_STRVAR(xmlparse_ParseFile__doc__,
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 @@ PyDoc_STRVAR(xmlparse_GetBase__doc__,
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 @@ If the event was generated by a large amount of text (such as a start tag\n\
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 @@ xmlparse_UseForeignDTD(xmlparseobject *self, PyObject *args)
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 @@ static struct PyMethodDef xmlparse_methods[] = {
{"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__},
diff --git a/Modules/resource.c b/Modules/resource.c
index e73c878158..fe6f3b6a25 100644
--- a/Modules/resource.c
+++ b/Modules/resource.c
@@ -194,12 +194,9 @@ resource_setrlimit(PyObject *self, PyObject *args)
}
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 @@ resource_methods[] = {
{"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 */
};
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 4a04af179c..dfa4e85e3b 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -218,7 +218,7 @@ select_select(PyObject *self, PyObject *args)
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 @@ PyDoc_STRVAR(poll_unregister_doc,
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 @@ poll_poll(pollObject *self, PyObject *args)
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 @@ static PyMethodDef poll_methods[] = {
{"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 @@ PyDoc_STRVAR(poll_doc,
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 @@ On Windows, only sockets are supported; on Unix, all file descriptors.");
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 */
};
diff --git a/Modules/sha256module.c b/Modules/sha256module.c
index 7037ca0f58..0effb0734c 100644
--- a/Modules/sha256module.c
+++ b/Modules/sha256module.c
@@ -405,14 +405,10 @@ SHA_dealloc(PyObject *ptr)
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 @@ PyDoc_STRVAR(SHA256_digest__doc__,
"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 @@ PyDoc_STRVAR(SHA256_hexdigest__doc__,
"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 @@ SHA256_hexdigest(SHAobject *self, PyObject *args)
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 @@ SHA256_update(SHAobject *self, PyObject *args)
}
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 */
};
diff --git a/Modules/sha512module.c b/Modules/sha512module.c
index c5a85ff589..9f47b6128b 100644
--- a/Modules/sha512module.c
+++ b/Modules/sha512module.c
@@ -471,14 +471,10 @@ SHA512_dealloc(PyObject *ptr)
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 @@ PyDoc_STRVAR(SHA512_digest__doc__,
"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 @@ PyDoc_STRVAR(SHA512_hexdigest__doc__,
"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 @@ SHA512_hexdigest(SHAobject *self, PyObject *args)
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 @@ SHA512_hexdigest(SHAobject *self, PyObject *args)
}
/* 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 @@ SHA512_update(SHAobject *self, PyObject *args)
}
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 */
};
diff --git a/Modules/shamodule.c b/Modules/shamodule.c
index 058391d565..8d68d16eac 100644
--- a/Modules/shamodule.c
+++ b/Modules/shamodule.c
@@ -358,13 +358,10 @@ SHA_dealloc(PyObject *ptr)
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 @@ PyDoc_STRVAR(SHA_digest__doc__,
"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 @@ PyDoc_STRVAR(SHA_hexdigest__doc__,
"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 @@ SHA_hexdigest(SHAobject *self, PyObject *args)
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 @@ SHA_update(SHAobject *self, PyObject *args)
}
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 */
};
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 6f9f5f38c2..5f7a520cf4 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2889,12 +2889,10 @@ static PyTypeObject sock_type = {
/*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 @@ static PyMethodDef socket_methods[] = {
{"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},
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index dd35923139..4a77916942 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -98,10 +98,8 @@ syslog_syslog(PyObject * self, PyObject * args)
}
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 @@ syslog_log_upto(PyObject *self, PyObject *args)
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},
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index 9ac9881d9c..6169658f93 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -456,7 +456,8 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
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,
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index e03b7e1391..87e543f788 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -123,11 +123,9 @@ _PyTime_DoubleToTimet(double x)
}
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 @@ Fractions of a second may be present if the system clock provides them.");
#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 @@ time_clock(PyObject *self, PyObject *args)
#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 @@ time_asctime(PyObject *self, PyObject *args)
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_ctime(PyObject *self, PyObject *args)
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 @@ not present, current time as returned by localtime() is used.");
#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 @@ Convert a time tuple in local time to seconds since the Epoch.");
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 @@ void inittimezone(PyObject *m) {
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 @@ static PyMethodDef time_methods[] = {
{"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 */
};
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 15e53dd23b..4d0c4f6ee8 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -216,7 +216,7 @@ gen_throw(PyGenObject *gen, PyObject *args)
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
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 8612c2430a..37d4b38de4 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -200,7 +200,7 @@ static PyObject *
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 @@ static PyObject *
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);
}