diff options
author | Guido van Rossum <guido@python.org> | 2000-02-29 13:59:29 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-02-29 13:59:29 (GMT) |
commit | 43713e5a2899930a8698e244b0d0fef59a676d17 (patch) | |
tree | 3d9740aff47f70cea403a2c924a37b468d1eded6 /Modules | |
parent | a9b2b4be26df7c3da8a20d1a5f4d2b796e455b4b (diff) | |
download | cpython-43713e5a2899930a8698e244b0d0fef59a676d17.zip cpython-43713e5a2899930a8698e244b0d0fef59a676d17.tar.gz cpython-43713e5a2899930a8698e244b0d0fef59a676d17.tar.bz2 |
Massive patch by Skip Montanaro to add ":name" to as many
PyArg_ParseTuple() format string arguments as possible.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_localemodule.c | 6 | ||||
-rw-r--r-- | Modules/_tkinter.c | 56 | ||||
-rw-r--r-- | Modules/almodule.c | 104 | ||||
-rw-r--r-- | Modules/audioop.c | 4 | ||||
-rw-r--r-- | Modules/binascii.c | 20 | ||||
-rw-r--r-- | Modules/bsddbmodule.c | 6 | ||||
-rw-r--r-- | Modules/cPickle.c | 22 | ||||
-rw-r--r-- | Modules/cStringIO.c | 14 | ||||
-rw-r--r-- | Modules/cdmodule.c | 52 | ||||
-rw-r--r-- | Modules/dbmmodule.c | 2 | ||||
-rw-r--r-- | Modules/fcntlmodule.c | 2 | ||||
-rw-r--r-- | Modules/gdbmmodule.c | 2 | ||||
-rw-r--r-- | Modules/md5module.c | 2 | ||||
-rw-r--r-- | Modules/newmodule.c | 12 | ||||
-rw-r--r-- | Modules/pcremodule.c | 6 | ||||
-rw-r--r-- | Modules/puremodule.c | 22 | ||||
-rw-r--r-- | Modules/readline.c | 10 | ||||
-rw-r--r-- | Modules/regexmodule.c | 10 | ||||
-rw-r--r-- | Modules/resource.c | 8 | ||||
-rw-r--r-- | Modules/rotormodule.c | 4 | ||||
-rw-r--r-- | Modules/selectmodule.c | 2 | ||||
-rw-r--r-- | Modules/shamodule.c | 2 | ||||
-rw-r--r-- | Modules/socketmodule.c | 18 | ||||
-rw-r--r-- | Modules/soundex.c | 4 | ||||
-rw-r--r-- | Modules/stropmodule.c | 24 | ||||
-rw-r--r-- | Modules/structmodule.c | 4 | ||||
-rw-r--r-- | Modules/syslogmodule.c | 6 | ||||
-rw-r--r-- | Modules/threadmodule.c | 2 | ||||
-rw-r--r-- | Modules/timemodule.c | 8 | ||||
-rw-r--r-- | Modules/xxmodule.c | 10 | ||||
-rw-r--r-- | Modules/zlibmodule.c | 18 |
31 files changed, 231 insertions, 231 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 3b84729..2f14790 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -135,7 +135,7 @@ PyLocale_setlocale(self,args) char *locale=0,*result; PyObject *result_object; struct lconv *lc; - if(!PyArg_ParseTuple(args,"i|z",&category,&locale))return 0; + if(!PyArg_ParseTuple(args,"i|z:setlocale",&category,&locale))return 0; if(locale){ /* set locale */ result=setlocale(category,locale); @@ -266,7 +266,7 @@ PyLocale_strcoll(self,args) PyObject *args; { char *s1,*s2; - if(!PyArg_ParseTuple(args,"ss",&s1,&s2)) + if(!PyArg_ParseTuple(args,"ss:strcoll",&s1,&s2)) return NULL; return PyInt_FromLong(strcoll(s1,s2)); } @@ -283,7 +283,7 @@ PyLocale_strxfrm(self,args) char *s,*buf; int n1,n2; PyObject *result; - if(!PyArg_ParseTuple(args,"s",&s)) + if(!PyArg_ParseTuple(args,"s:strxfrm",&s)) return NULL; /* assume no change in size, first */ n1=strlen(s)+1; diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index fd0a69c..d94ae36 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -697,7 +697,7 @@ Tkapp_Eval(self, args) PyObject *res = NULL; int err; - if (!PyArg_ParseTuple(args, "s", &script)) + if (!PyArg_ParseTuple(args, "s:eval", &script)) return NULL; ENTER_TCL @@ -720,7 +720,7 @@ Tkapp_GlobalEval(self, args) PyObject *res = NULL; int err; - if (!PyArg_ParseTuple(args, "s", &script)) + if (!PyArg_ParseTuple(args, "s:globaleval", &script)) return NULL; ENTER_TCL @@ -743,7 +743,7 @@ Tkapp_EvalFile(self, args) PyObject *res = NULL; int err; - if (!PyArg_ParseTuple(args, "s", &fileName)) + if (!PyArg_ParseTuple(args, "s:evalfile", &fileName)) return NULL; ENTER_TCL @@ -788,7 +788,7 @@ Tkapp_AddErrorInfo(self, args) { char *msg; - if (!PyArg_ParseTuple(args, "s", &msg)) + if (!PyArg_ParseTuple(args, "s:adderrorinfo", &msg)) return NULL; ENTER_TCL Tcl_AddErrorInfo(Tkapp_Interp(self), msg); @@ -816,7 +816,7 @@ SetVar(self, args, flags) if (!tmp) return NULL; - if (PyArg_ParseTuple(args, "sO", &name1, &newValue)) { + if (PyArg_ParseTuple(args, "sO:setvar", &name1, &newValue)) { /* XXX Merge? */ s = AsString(newValue, tmp); ENTER_TCL @@ -825,7 +825,7 @@ SetVar(self, args, flags) } else { PyErr_Clear(); - if (PyArg_ParseTuple(args, "ssO", &name1, &name2, &newValue)) { + if (PyArg_ParseTuple(args, "ssO:setvar", &name1, &name2, &newValue)) { s = AsString (newValue, tmp); ENTER_TCL ok = Tcl_SetVar2(Tkapp_Interp(self), name1, name2, @@ -873,7 +873,7 @@ GetVar(self, args, flags) char *name1, *name2=NULL, *s; PyObject *res = NULL; - if (!PyArg_ParseTuple(args, "s|s", &name1, &name2)) + if (!PyArg_ParseTuple(args, "s|s:getvar", &name1, &name2)) return NULL; ENTER_TCL if (name2 == NULL) @@ -919,7 +919,7 @@ UnsetVar(self, args, flags) PyObject *res = NULL; int code; - if (!PyArg_ParseTuple(args, "s|s", &name1, &name2)) + if (!PyArg_ParseTuple(args, "s|s:unsetvar", &name1, &name2)) return NULL; ENTER_TCL if (name2 == NULL) @@ -967,7 +967,7 @@ Tkapp_GetInt(self, args) char *s; int v; - if (!PyArg_ParseTuple(args, "s", &s)) + if (!PyArg_ParseTuple(args, "s:getint", &s)) return NULL; if (Tcl_GetInt(Tkapp_Interp(self), s, &v) == TCL_ERROR) return Tkinter_Error(self); @@ -982,7 +982,7 @@ Tkapp_GetDouble(self, args) char *s; double v; - if (!PyArg_ParseTuple(args, "s", &s)) + if (!PyArg_ParseTuple(args, "s:getdouble", &s)) return NULL; if (Tcl_GetDouble(Tkapp_Interp(self), s, &v) == TCL_ERROR) return Tkinter_Error(self); @@ -997,7 +997,7 @@ Tkapp_GetBoolean(self, args) char *s; int v; - if (!PyArg_ParseTuple(args, "s", &s)) + if (!PyArg_ParseTuple(args, "s:getboolean", &s)) return NULL; if (Tcl_GetBoolean(Tkapp_Interp(self), s, &v) == TCL_ERROR) return Tkinter_Error(self); @@ -1013,7 +1013,7 @@ Tkapp_ExprString(self, args) PyObject *res = NULL; int retval; - if (!PyArg_ParseTuple(args, "s", &s)) + if (!PyArg_ParseTuple(args, "s:exprstring", &s)) return NULL; ENTER_TCL retval = Tcl_ExprString(Tkapp_Interp(self), s); @@ -1036,7 +1036,7 @@ Tkapp_ExprLong(self, args) int retval; long v; - if (!PyArg_ParseTuple(args, "s", &s)) + if (!PyArg_ParseTuple(args, "s:exprlong", &s)) return NULL; ENTER_TCL retval = Tcl_ExprLong(Tkapp_Interp(self), s, &v); @@ -1059,7 +1059,7 @@ Tkapp_ExprDouble(self, args) double v; int retval; - if (!PyArg_ParseTuple(args, "s", &s)) + if (!PyArg_ParseTuple(args, "s:exprdouble", &s)) return NULL; PyFPE_START_PROTECT("Tkapp_ExprDouble", return 0) ENTER_TCL @@ -1084,7 +1084,7 @@ Tkapp_ExprBoolean(self, args) int retval; int v; - if (!PyArg_ParseTuple(args, "s", &s)) + if (!PyArg_ParseTuple(args, "s:exprboolean", &s)) return NULL; ENTER_TCL retval = Tcl_ExprBoolean(Tkapp_Interp(self), s, &v); @@ -1110,7 +1110,7 @@ Tkapp_SplitList(self, args) PyObject *v; int i; - if (!PyArg_ParseTuple(args, "s", &list)) + if (!PyArg_ParseTuple(args, "s:splitlist", &list)) return NULL; if (Tcl_SplitList(Tkapp_Interp(self), list, &argc, &argv) == TCL_ERROR) @@ -1140,7 +1140,7 @@ Tkapp_Split(self, args) { char *list; - if (!PyArg_ParseTuple(args, "s", &list)) + if (!PyArg_ParseTuple(args, "s:split", &list)) return NULL; return Split(list); } @@ -1261,7 +1261,7 @@ Tkapp_CreateCommand(self, args) PyObject *func; Tcl_Command err; - if (!PyArg_ParseTuple(args, "sO", &cmdName, &func)) + if (!PyArg_ParseTuple(args, "sO:createcommand", &cmdName, &func)) return NULL; if (!PyCallable_Check(func)) { PyErr_SetString(PyExc_TypeError, "command not callable"); @@ -1300,7 +1300,7 @@ Tkapp_DeleteCommand(self, args) char *cmdName; int err; - if (!PyArg_ParseTuple(args, "s", &cmdName)) + if (!PyArg_ParseTuple(args, "s:deletecommand", &cmdName)) return NULL; ENTER_TCL err = Tcl_DeleteCommand(Tkapp_Interp(self), cmdName); @@ -1443,7 +1443,7 @@ Tkapp_CreateFileHandler(self, args) int mask, id; FHANDLE tfile; - if (!PyArg_ParseTuple(args, "OiO", &file, &mask, &func)) + if (!PyArg_ParseTuple(args, "OiO:createfilehandler", &file, &mask, &func)) return NULL; id = GetFileNo(file); if (id < 0) @@ -1476,7 +1476,7 @@ Tkapp_DeleteFileHandler(self, args) int id; FHANDLE tfile; - if (!PyArg_ParseTuple(args, "O", &file)) + if (!PyArg_ParseTuple(args, "O:deletefilehandler", &file)) return NULL; id = GetFileNo(file); if (id < 0) @@ -1513,7 +1513,7 @@ Tktt_DeleteTimerHandler(self, args) TkttObject *v = (TkttObject *)self; PyObject *func = v->func; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":deletetimerhandler")) return NULL; if (v->token != NULL) { Tcl_DeleteTimerHandler(v->token); @@ -1646,7 +1646,7 @@ Tkapp_CreateTimerHandler(self, args) PyObject *func; TkttObject *v; - if (!PyArg_ParseTuple(args, "iO", &milliseconds, &func)) + if (!PyArg_ParseTuple(args, "iO:createtimerhandler", &milliseconds, &func)) return NULL; if (!PyCallable_Check(func)) { PyErr_SetString(PyExc_TypeError, "bad argument list"); @@ -1672,7 +1672,7 @@ Tkapp_MainLoop(self, args) PyThreadState *tstate = PyThreadState_Get(); #endif - if (!PyArg_ParseTuple(args, "|i", &threshold)) + if (!PyArg_ParseTuple(args, "|i:mainloop", &threshold)) return NULL; quitMainLoop = 0; @@ -1721,7 +1721,7 @@ Tkapp_DoOneEvent(self, args) int flags = 0; int rv; - if (!PyArg_ParseTuple(args, "|i", &flags)) + if (!PyArg_ParseTuple(args, "|i:dooneevent", &flags)) return NULL; ENTER_TCL @@ -1736,7 +1736,7 @@ Tkapp_Quit(self, args) PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":quit")) return NULL; quitMainLoop = 1; @@ -1750,7 +1750,7 @@ Tkapp_InterpAddr(self, args) PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":interpaddr")) return NULL; return PyInt_FromLong((long)Tkapp_Interp(self)); @@ -1862,7 +1862,7 @@ Tkinter_Create(self, args) baseName = Py_GetProgramName(); className = "Tk"; - if (!PyArg_ParseTuple(args, "|zssi", + if (!PyArg_ParseTuple(args, "|zssi:create", &screenName, &baseName, &className, &interactive)) return NULL; diff --git a/Modules/almodule.c b/Modules/almodule.c index 7fcfae6..1033c07 100644 --- a/Modules/almodule.c +++ b/Modules/almodule.c @@ -281,7 +281,7 @@ SetConfig(self, args, func) { int par; - if (!PyArg_ParseTuple(args, "i", &par)) + if (!PyArg_ParseTuple(args, "i:SetConfig", &par)) return NULL; if ((*func)(self->config, par) == -1) @@ -299,7 +299,7 @@ GetConfig(self, args, func) { int par; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetConfig")) return NULL; if ((par = (*func)(self->config)) == -1) @@ -397,7 +397,7 @@ alc_SetFloatMax(self, args) { double maximum_value; - if (!PyArg_ParseTuple(args, "d", &maximum_value)) + if (!PyArg_ParseTuple(args, "d:SetFloatMax", &maximum_value)) return NULL; if (alSetFloatMax(self->config, maximum_value) < 0) return NULL; @@ -417,7 +417,7 @@ alc_GetFloatMax(self, args) { double maximum_value; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFloatMax")) return NULL; if ((maximum_value = alGetFloatMax(self->config)) == 0) return NULL; @@ -486,7 +486,7 @@ setconfig(self, args, func) { long par; - if (!PyArg_ParseTuple(args, "l", &par)) + if (!PyArg_ParseTuple(args, "l:SetConfig", &par)) return NULL; if ((*func)(self->config, par) == -1) @@ -504,7 +504,7 @@ getconfig(self, args, func) { long par; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetConfig")) return NULL; if ((par = (*func)(self->config)) == -1) @@ -586,7 +586,7 @@ alc_getfloatmax(self, args) { double arg; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFloatMax")) return 0; if ((arg = ALgetfloatmax(self->config)) == 0) return NULL; @@ -600,7 +600,7 @@ alc_setfloatmax(self, args) { double arg; - if (!PyArg_ParseTuple(args, "d", &arg)) + if (!PyArg_ParseTuple(args, "d:SetFloatMax", &arg)) return 0; if (ALsetfloatmax(self->config, arg) == -1) return NULL; @@ -723,7 +723,7 @@ alp_SetConfig(self, args) PyObject *args; { alcobject *config; - if (!PyArg_ParseTuple(args, "O!", &Alctype, &config)) + if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config)) return NULL; if (alSetConfig(self->port, config->config) < 0) return NULL; @@ -742,7 +742,7 @@ alp_GetConfig(self, args) PyObject *args; { ALconfig config; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetConfig")) return NULL; if ((config = alGetConfig(self->port)) == NULL) return NULL; @@ -761,7 +761,7 @@ alp_GetResource(self, args) { int resource; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetResource")) return NULL; if ((resource = alGetResource(self->port)) == 0) return NULL; @@ -780,7 +780,7 @@ alp_GetFD(self, args) { int fd; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFD")) return NULL; if ((fd = alGetFD(self->port)) < 0) @@ -801,7 +801,7 @@ alp_GetFilled(self, args) { int filled; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFilled")) return NULL; if ((filled = alGetFilled(self->port)) < 0) return NULL; @@ -820,7 +820,7 @@ alp_GetFillable(self, args) { int fillable; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFillable")) return NULL; if ((fillable = alGetFillable(self->port)) < 0) return NULL; @@ -844,7 +844,7 @@ alp_ReadFrames(self, args) int ch; ALconfig c; - if (!PyArg_ParseTuple(args, "i", &framecount)) + if (!PyArg_ParseTuple(args, "i:ReadFrames", &framecount)) return NULL; if (framecount < 0) { PyErr_SetString(ErrorObject, "negative framecount"); @@ -910,7 +910,7 @@ alp_DiscardFrames(self, args) { int framecount; - if (!PyArg_ParseTuple(args, "i", &framecount)) + if (!PyArg_ParseTuple(args, "i:DiscardFrames", &framecount)) return NULL; Py_BEGIN_ALLOW_THREADS @@ -935,7 +935,7 @@ alp_ZeroFrames(self, args) { int framecount; - if (!PyArg_ParseTuple(args, "i", &framecount)) + if (!PyArg_ParseTuple(args, "i:ZeroFrames", &framecount)) return NULL; if (framecount < 0) { @@ -963,7 +963,7 @@ alp_SetFillPoint(self, args) { int fillpoint; - if (!PyArg_ParseTuple(args, "i", &fillpoint)) + if (!PyArg_ParseTuple(args, "i:SetFillPoint", &fillpoint)) return NULL; if (alSetFillPoint(self->port, fillpoint) < 0) @@ -985,7 +985,7 @@ alp_GetFillPoint(self, args) { int fillpoint; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFillPoint")) return NULL; if ((fillpoint = alGetFillPoint(self->port)) < 0) @@ -1006,7 +1006,7 @@ alp_GetFrameNumber(self, args) { stamp_t fnum; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFrameNumber")) return NULL; if (alGetFrameNumber(self->port, &fnum) < 0) @@ -1028,7 +1028,7 @@ alp_GetFrameTime(self, args) stamp_t fnum, time; PyObject *ret, *v0, *v1; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFrameTime")) return NULL; if (alGetFrameTime(self->port, &fnum, &time) < 0) return NULL; @@ -1060,7 +1060,7 @@ alp_WriteFrames(self, args) int size, ch; ALconfig c; - if (!PyArg_ParseTuple(args, "s#", &samples, &length)) + if (!PyArg_ParseTuple(args, "s#:WriteFrames", &samples, &length)) return NULL; c = alGetConfig(self->port); switch (alGetSampFmt(c)) { @@ -1123,7 +1123,7 @@ alp_ClosePort(self, args) alpobject *self; PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":ClosePort")) return NULL; if (alClosePort(self->port) < 0) return NULL; @@ -1140,7 +1140,7 @@ alp_closeport(self, args) alpobject *self; PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":ClosePort")) return NULL; if (ALcloseport(self->port) < 0) return NULL; @@ -1150,13 +1150,13 @@ alp_closeport(self, args) } static PyObject * -alp_getfd (self, args) +alp_getfd(self, args) alpobject *self; PyObject *args; { int fd; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFD")) return NULL; if ((fd = ALgetfd(self-> port)) == -1) return NULL; @@ -1170,7 +1170,7 @@ alp_getfilled(self, args) { long count; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFilled")) return NULL; if ((count = ALgetfilled(self-> port)) == -1) return NULL; @@ -1184,7 +1184,7 @@ alp_getfillable(self, args) { long count; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFillable")) return NULL; if ((count = ALgetfillable(self-> port)) == -1) return NULL; @@ -1202,7 +1202,7 @@ alp_readsamps(self, args) int width; int ret; - if (!PyArg_ParseTuple(args, "l", &count)) + if (!PyArg_ParseTuple(args, "l:readsamps", &count)) return NULL; if (count <= 0) { @@ -1248,7 +1248,7 @@ alp_writesamps(self, args) ALconfig c; int ret; - if (!PyArg_ParseTuple(args, "s#", &buf, &size)) + if (!PyArg_ParseTuple(args, "s#:writesamps", &buf, &size)) return NULL; c = ALgetconfig(self->port); @@ -1281,7 +1281,7 @@ alp_getfillpoint(self, args) { long count; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetFillPoint")) return NULL; if ((count = ALgetfillpoint(self->port)) == -1) return NULL; @@ -1289,13 +1289,13 @@ alp_getfillpoint(self, args) } static PyObject * -alp_setfillpoint (self, args) +alp_setfillpoint(self, args) alpobject *self; PyObject *args; { long count; - if (!PyArg_ParseTuple(args, "l", &count)) + if (!PyArg_ParseTuple(args, "l:SetFillPoint", &count)) return NULL; if (ALsetfillpoint(self->port, count) == -1) return NULL; @@ -1310,7 +1310,7 @@ alp_setconfig(self, args) { alcobject *config; - if (!PyArg_ParseTuple(args, "O!", &Alctype, &config)) + if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config)) return NULL; if (ALsetconfig(self->port, config->config) == -1) return NULL; @@ -1325,7 +1325,7 @@ alp_getconfig(self, args) { ALconfig config; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":GetConfig")) return NULL; config = ALgetconfig(self->port); if (config == NULL) @@ -1504,7 +1504,7 @@ al_NewConfig(self, args) { ALconfig config; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":NewConfig")) return NULL; if ((config = alNewConfig()) == NULL) return NULL; @@ -1524,7 +1524,7 @@ al_OpenPort(self, args) char *name, *dir; alcobject *config = NULL; - if (!PyArg_ParseTuple(args, "ss|O!", &name, &dir, &Alctype, &config)) + if (!PyArg_ParseTuple(args, "ss|O!:OpenPort", &name, &dir, &Alctype, &config)) return NULL; if ((port = alOpenPort(name, dir, config ? config->config : NULL)) == NULL) return NULL; @@ -1545,7 +1545,7 @@ al_Connect(self, args) ALparamInfo *propinfo = NULL; PyObject *propobj = NULL; - if (!PyArg_ParseTuple(args, "ii|O!", &source, &dest, &PyList_Type, &propobj)) + if (!PyArg_ParseTuple(args, "ii|O!:Connect", &source, &dest, &PyList_Type, &propobj)) return NULL; if (propobj != NULL) { nprops = python2params(source, dest, propobj, &props, &propinfo); @@ -1584,7 +1584,7 @@ al_Disconnect(self, args) { int res; - if (!PyArg_ParseTuple(args, "i", &res)) + if (!PyArg_ParseTuple(args, "i:Disconnect", &res)) return NULL; if (alDisconnect(res) < 0) return NULL; @@ -1607,7 +1607,7 @@ al_GetParams(self, args) int i, j, npvs; ALparamInfo *pinfo; - if (!PyArg_ParseTuple(args, "iO!", &resource, &PyList_Type, &pvslist)) + if (!PyArg_ParseTuple(args, "iO!:GetParams", &resource, &PyList_Type, &pvslist)) return NULL; npvs = PyList_Size(pvslist); pvs = PyMem_NEW(ALpv, npvs); @@ -1753,7 +1753,7 @@ al_SetParams(self, args) ALparamInfo *pinfo; int npvs, i; - if (!PyArg_ParseTuple(args, "iO!", &resource, &PyList_Type, &pvslist)) + if (!PyArg_ParseTuple(args, "iO!:SetParams", &resource, &PyList_Type, &pvslist)) return NULL; npvs = python2params(resource, -1, pvslist, &pvs, &pinfo); if (npvs < 0) @@ -1804,7 +1804,7 @@ al_QueryValues(self, args) PyObject *qualobj = NULL; PyObject *res = NULL, *item; - if (!PyArg_ParseTuple(args, "ii|O!", &resource, ¶m, + if (!PyArg_ParseTuple(args, "ii|O!:QueryValues", &resource, ¶m, &PyList_Type, &qualobj)) return NULL; if (qualobj != NULL) { @@ -1881,7 +1881,7 @@ al_GetParamInfo(self, args) ALparamInfo pinfo; PyObject *v, *item;; - if (!PyArg_ParseTuple(args, "ii", &res, ¶m)) + if (!PyArg_ParseTuple(args, "ii:GetParamInfo", &res, ¶m)) return NULL; if (alGetParamInfo(res, param, &pinfo) < 0) return NULL; @@ -1965,7 +1965,7 @@ al_GetResourceByName(self, args) int res, start_res, type; char *name; - if (!PyArg_ParseTuple(args, "isi", &start_res, &name, &type)) + if (!PyArg_ParseTuple(args, "isi:GetResourceByName", &start_res, &name, &type)) return NULL; if ((res = alGetResourceByName(start_res, name, type)) == 0) return NULL; @@ -1983,7 +1983,7 @@ al_IsSubtype(self, args) { int type, subtype; - if (!PyArg_ParseTuple(args, "ii", &type, &subtype)) + if (!PyArg_ParseTuple(args, "ii:IsSubtype", &type, &subtype)) return NULL; return PyInt_FromLong((long) alIsSubtype(type, subtype)); } @@ -1998,7 +1998,7 @@ al_SetErrorHandler(self, args) PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":SetErrorHandler")) return NULL; Py_INCREF(Py_None); return Py_None; @@ -2016,7 +2016,7 @@ al_openport(self, args) ALport port; alcobject *config = NULL; - if (!PyArg_ParseTuple(args, "ss|O!", &name, &dir, &Alctype, &config)) + if (!PyArg_ParseTuple(args, "ss|O!:OpenPort", &name, &dir, &Alctype, &config)) return NULL; if ((port = ALopenport(name, dir, config ? config->config : NULL)) == NULL) return NULL; @@ -2029,7 +2029,7 @@ al_newconfig(self, args) { ALconfig config; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":NewConfig")) return NULL; if ((config = ALnewconfig ()) == NULL) return NULL; @@ -2047,7 +2047,7 @@ al_queryparams(self, args) PyObject *v = NULL; int i; - if (!PyArg_ParseTuple(args, "l", &device)) + if (!PyArg_ParseTuple(args, "l:queryparams", &device)) return NULL; if ((length = ALqueryparams(device, PVdummy, 2L)) == -1) return NULL; @@ -2127,7 +2127,7 @@ al_getname(self, args) long device, descriptor; char *name; - if (!PyArg_ParseTuple(args, "ll", &device, &descriptor)) + if (!PyArg_ParseTuple(args, "ll:getname", &device, &descriptor)) return NULL; if ((name = ALgetname(device, descriptor)) == NULL) return NULL; @@ -2140,7 +2140,7 @@ al_getdefault(self, args) { long device, descriptor, value; - if (!PyArg_ParseTuple(args, "ll", &device, &descriptor)) + if (!PyArg_ParseTuple(args, "ll:getdefault", &device, &descriptor)) return NULL; if ((value = ALgetdefault(device, descriptor)) == -1) return NULL; @@ -2153,7 +2153,7 @@ al_getminmax(self, args) { long device, descriptor, min, max; - if (!PyArg_ParseTuple(args, "ll", &device, &descriptor)) + if (!PyArg_ParseTuple(args, "ll:getminmax", &device, &descriptor)) return NULL; min = -1; max = -1; diff --git a/Modules/audioop.c b/Modules/audioop.c index 02a30c6..702ca90 100644 --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -981,7 +981,7 @@ audioop_ratecv(self, args) weightA = 1; weightB = 0; - if (!PyArg_ParseTuple(args, "s#iiiiO|ii", &cp, &len, &size, &nchannels, + if (!PyArg_ParseTuple(args, "s#iiiiO|ii:ratecv", &cp, &len, &size, &nchannels, &inrate, &outrate, &state, &weightA, &weightB)) return NULL; if (size != 1 && size != 2 && size != 4) { @@ -1034,7 +1034,7 @@ audioop_ratecv(self, args) } for (chan = 0; chan < nchannels; chan++) { if (!PyArg_ParseTuple(PyTuple_GetItem(samps, chan), - "ii",&prev_i[chan],&cur_i[chan])) + "ii:ratecv",&prev_i[chan],&cur_i[chan])) goto exit; } } diff --git a/Modules/binascii.c b/Modules/binascii.c index 55f08bf..d1ada65 100644 --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -213,7 +213,7 @@ binascii_a2b_uu(self, args) PyObject *rv; int ascii_len, bin_len; - if ( !PyArg_ParseTuple(args, "t#", &ascii_data, &ascii_len) ) + if ( !PyArg_ParseTuple(args, "t#:a2b_uu", &ascii_data, &ascii_len) ) return NULL; /* First byte: binary data length (in bytes) */ @@ -290,7 +290,7 @@ binascii_b2a_uu(self, args) PyObject *rv; int bin_len; - if ( !PyArg_ParseTuple(args, "s#", &bin_data, &bin_len) ) + if ( !PyArg_ParseTuple(args, "s#:b2a_uu", &bin_data, &bin_len) ) return NULL; if ( bin_len > 45 ) { /* The 45 is a limit that appears in all uuencode's */ @@ -372,7 +372,7 @@ binascii_a2b_base64(self, args) int ascii_len, bin_len; int quad_pos = 0; - if ( !PyArg_ParseTuple(args, "t#", &ascii_data, &ascii_len) ) + if ( !PyArg_ParseTuple(args, "t#:a2b_base64", &ascii_data, &ascii_len) ) return NULL; bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */ @@ -456,7 +456,7 @@ binascii_b2a_base64(self, args) PyObject *rv; int bin_len; - if ( !PyArg_ParseTuple(args, "s#", &bin_data, &bin_len) ) + if ( !PyArg_ParseTuple(args, "s#:b2a_base64", &bin_data, &bin_len) ) return NULL; if ( bin_len > BASE64_MAXBIN ) { PyErr_SetString(Error, "Too much data for base64 line"); @@ -510,7 +510,7 @@ binascii_a2b_hqx(self, args) int len; int done = 0; - if ( !PyArg_ParseTuple(args, "t#", &ascii_data, &len) ) + if ( !PyArg_ParseTuple(args, "t#:a2b_hqx", &ascii_data, &len) ) return NULL; /* Allocate a string that is too big (fixed later) */ @@ -573,7 +573,7 @@ PyObject *args; unsigned char ch; int in, inend, len; - if ( !PyArg_ParseTuple(args, "s#", &in_data, &len) ) + if ( !PyArg_ParseTuple(args, "s#:rlecode_hqx", &in_data, &len) ) return NULL; /* Worst case: output is twice as big as input (fixed later) */ @@ -624,7 +624,7 @@ binascii_b2a_hqx(self, args) PyObject *rv; int len; - if ( !PyArg_ParseTuple(args, "s#", &bin_data, &len) ) + if ( !PyArg_ParseTuple(args, "s#:b2a_hqx", &bin_data, &len) ) return NULL; /* Allocate a buffer that is at least large enough */ @@ -664,7 +664,7 @@ binascii_rledecode_hqx(self, args) PyObject *rv; int in_len, out_len, out_len_left; - if ( !PyArg_ParseTuple(args, "s#", &in_data, &in_len) ) + if ( !PyArg_ParseTuple(args, "s#:rledecode_hqx", &in_data, &in_len) ) return NULL; /* Empty string is a special case */ @@ -762,7 +762,7 @@ PyObject *args; unsigned int crc; int len; - if ( !PyArg_ParseTuple(args, "s#i", &bin_data, &len, &crc) ) + if ( !PyArg_ParseTuple(args, "s#i:crc_hqx", &bin_data, &len, &crc) ) return NULL; while(len--) { @@ -902,7 +902,7 @@ binascii_crc32(self, args) unsigned long crc = 0UL; /* initial value of CRC */ int len; - if ( !PyArg_ParseTuple(args, "s#|l", &bin_data, &len, &crc) ) + if ( !PyArg_ParseTuple(args, "s#|l:crc32", &bin_data, &len, &crc) ) return NULL; crc = crc ^ 0xFFFFFFFFUL; diff --git a/Modules/bsddbmodule.c b/Modules/bsddbmodule.c index 514159f..16178ed 100644 --- a/Modules/bsddbmodule.c +++ b/Modules/bsddbmodule.c @@ -697,7 +697,7 @@ bsdhashopen(self, args) int hash = 0; /* XXX currently ignored */ int lorder = 0; - if (!PyArg_ParseTuple(args, "s|siiiiiii", + if (!PyArg_ParseTuple(args, "s|siiiiiii:hashopen", &file, &flag, &mode, &bsize, &ffactor, &nelem, &cachesize, &hash, &lorder)) @@ -750,7 +750,7 @@ bsdbtopen(self, args) unsigned int psize = 0; int lorder = 0; - if (!PyArg_ParseTuple(args, "s|siiiiiii", + if (!PyArg_ParseTuple(args, "s|siiiiiii:btopen", &file, &flag, &mode, &btflags, &cachesize, &maxkeypage, &minkeypage, &psize, &lorder)) @@ -805,7 +805,7 @@ bsdrnopen(self, args) char *bval = ""; char *bfname = NULL; - if (!PyArg_ParseTuple(args, "s|siiiiiiss", + if (!PyArg_ParseTuple(args, "s|siiiiiiss:rnopen", &file, &flag, &mode, &rnflags, &cachesize, &psize, &lorder, &reclen, &bval, &bfname)) diff --git a/Modules/cPickle.c b/Modules/cPickle.c index 0737d94..158ed1a 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -1868,7 +1868,7 @@ dump(Picklerobject *self, PyObject *args) { static PyObject * Pickle_clear_memo(Picklerobject *self, PyObject *args) { - if (args && ! PyArg_ParseTuple(args,"")) return NULL; + if (args && ! PyArg_ParseTuple(args,":clear_memo")) return NULL; if (self->memo) PyDict_Clear(self->memo); Py_INCREF(Py_None); return Py_None; @@ -1882,7 +1882,7 @@ Pickle_getvalue(Picklerobject *self, PyObject *args) { char *s, *p, *have_get; Pdata *data; - if (args && ! PyArg_ParseTuple(args,"|i",&clear)) return NULL; + if (args && ! PyArg_ParseTuple(args,"|i:getvalue",&clear)) return NULL; /* Check to make sure we are based on a list */ if (! Pdata_Check(self->file)) { @@ -2014,7 +2014,7 @@ Pickler_dump(Picklerobject *self, PyObject *args) { PyObject *ob; int get=0; - UNLESS (PyArg_ParseTuple(args, "O|i", &ob, &get)) + UNLESS (PyArg_ParseTuple(args, "O|i:dump", &ob, &get)) return NULL; if (dump(self, ob) < 0) @@ -2132,10 +2132,10 @@ get_Pickler(PyObject *self, PyObject *args) { int bin; bin=1; - if (! PyArg_ParseTuple(args, "|i", &bin)) { + if (! PyArg_ParseTuple(args, "|i:Pickler", &bin)) { PyErr_Clear(); bin=0; - if (! PyArg_ParseTuple(args, "O|i", &file, &bin)) + if (! PyArg_ParseTuple(args, "O|i:Pickler", &file, &bin)) return NULL; } return (PyObject *)newPicklerobject(file, bin); @@ -3853,7 +3853,7 @@ noload(Unpicklerobject *self) { static PyObject * Unpickler_load(Unpicklerobject *self, PyObject *args) { - UNLESS (PyArg_ParseTuple(args, "")) + UNLESS (PyArg_ParseTuple(args, ":load")) return NULL; return load(self); @@ -3861,7 +3861,7 @@ Unpickler_load(Unpicklerobject *self, PyObject *args) { static PyObject * Unpickler_noload(Unpicklerobject *self, PyObject *args) { - UNLESS (PyArg_ParseTuple(args, "")) + UNLESS (PyArg_ParseTuple(args, ":noload")) return NULL; return noload(self); @@ -3969,7 +3969,7 @@ static PyObject * get_Unpickler(PyObject *self, PyObject *args) { PyObject *file; - UNLESS (PyArg_ParseTuple(args, "O", &file)) + UNLESS (PyArg_ParseTuple(args, "O:Unpickler", &file)) return NULL; return (PyObject *)newUnpicklerobject(file); } @@ -4110,7 +4110,7 @@ cpm_dumps(PyObject *self, PyObject *args) { Picklerobject *pickler = 0; int bin = 0; - UNLESS (PyArg_ParseTuple(args, "O|i", &ob, &bin)) + UNLESS (PyArg_ParseTuple(args, "O|i:dumps", &ob, &bin)) goto finally; UNLESS (file = PycStringIO->NewOutput(128)) @@ -4137,7 +4137,7 @@ cpm_load(PyObject *self, PyObject *args) { Unpicklerobject *unpickler = 0; PyObject *ob, *res = NULL; - UNLESS (PyArg_ParseTuple(args, "O", &ob)) + UNLESS (PyArg_ParseTuple(args, "O:load", &ob)) goto finally; UNLESS (unpickler = newUnpicklerobject(ob)) @@ -4157,7 +4157,7 @@ cpm_loads(PyObject *self, PyObject *args) { PyObject *ob, *file = 0, *res = NULL; Unpicklerobject *unpickler = 0; - UNLESS (PyArg_ParseTuple(args, "S", &ob)) + UNLESS (PyArg_ParseTuple(args, "S:loads", &ob)) goto finally; UNLESS (file = PycStringIO->NewInput(ob)) diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c index 0c4462d..6a5efd6 100644 --- a/Modules/cStringIO.c +++ b/Modules/cStringIO.c @@ -134,7 +134,7 @@ static PyObject * O_seek(Oobject *self, PyObject *args) { int position, mode = 0; - UNLESS(PyArg_ParseTuple(args, "i|i", &position, &mode)) { + UNLESS(PyArg_ParseTuple(args, "i|i:seek", &position, &mode)) { return NULL; } @@ -187,7 +187,7 @@ O_read(Oobject *self, PyObject *args) { int n = -1; char *output; - UNLESS(PyArg_ParseTuple(args, "|i", &n)) return NULL; + UNLESS(PyArg_ParseTuple(args, "|i:read", &n)) return NULL; n=O_cread((PyObject*)self,&output,n); @@ -264,7 +264,7 @@ O_write(Oobject *self, PyObject *args) { char *c; int l; - UNLESS(PyArg_ParseTuple(args, "O", &s)) return NULL; + UNLESS(PyArg_ParseTuple(args, "O:write", &s)) return NULL; UNLESS(-1 != (l=PyString_Size(s))) return NULL; UNLESS(c=PyString_AsString(s)) return NULL; UNLESS(-1 != O_cwrite((PyObject*)self,c,l)) return NULL; @@ -286,7 +286,7 @@ O_getval(Oobject *self, PyObject *args) { int s; use_pos=Py_None; - UNLESS(PyArg_ParseTuple(args,"|O",&use_pos)) return NULL; + UNLESS(PyArg_ParseTuple(args,"|O:getval",&use_pos)) return NULL; if(PyObject_IsTrue(use_pos)) { s=self->pos; if (s > self->string_size) s=self->string_size; @@ -350,7 +350,7 @@ O_writelines(Oobject *self, PyObject *args) { PyObject *string_module = 0; static PyObject *string_joinfields = 0; - UNLESS(PyArg_ParseTuple(args, "O", &args)) { + UNLESS(PyArg_ParseTuple(args, "O:writelines", &args)) { return NULL; } @@ -500,7 +500,7 @@ static PyObject * I_seek(Oobject *self, PyObject *args) { int position, mode = 0; - UNLESS(PyArg_ParseTuple(args, "i|i", &position, &mode)) { + UNLESS(PyArg_ParseTuple(args, "i|i:seek", &position, &mode)) { return NULL; } @@ -603,7 +603,7 @@ static PyObject * IO_StringIO(PyObject *self, PyObject *args) { PyObject *s=0; - UNLESS(PyArg_ParseTuple(args, "|O", &s)) return NULL; + UNLESS(PyArg_ParseTuple(args, "|O:StringIO", &s)) return NULL; if(s) return newIobject(s); return newOobject(128); } diff --git a/Modules/cdmodule.c b/Modules/cdmodule.c index 71598d7..1b414c1 100644 --- a/Modules/cdmodule.c +++ b/Modules/cdmodule.c @@ -50,7 +50,7 @@ CD_allowremoval(self, args) cdplayerobject *self; PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":allowremoval")) return NULL; CDallowremoval(self->ob_cdplayer); @@ -64,7 +64,7 @@ CD_preventremoval(self, args) cdplayerobject *self; PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":preventremoval")) return NULL; CDpreventremoval(self->ob_cdplayer); @@ -78,7 +78,7 @@ CD_bestreadsize(self, args) cdplayerobject *self; PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":bestreadsize")) return NULL; return PyInt_FromLong((long) CDbestreadsize(self->ob_cdplayer)); @@ -89,7 +89,7 @@ CD_close(self, args) cdplayerobject *self; PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":close")) return NULL; if (!CDclose(self->ob_cdplayer)) { @@ -109,7 +109,7 @@ CD_eject(self, args) { CDSTATUS status; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":eject")) return NULL; if (!CDeject(self->ob_cdplayer)) { @@ -132,7 +132,7 @@ CD_getstatus(self, args) { CDSTATUS status; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":getstatus")) return NULL; if (!CDgetstatus(self->ob_cdplayer, &status)) { @@ -157,7 +157,7 @@ CD_gettrackinfo(self, args) CDTRACKINFO info; CDSTATUS status; - if (!PyArg_ParseTuple(args, "i", &track)) + if (!PyArg_ParseTuple(args, "i:gettrackinfo", &track)) return NULL; if (!CDgettrackinfo(self->ob_cdplayer, track, &info)) { @@ -181,7 +181,7 @@ CD_msftoblock(self, args) { int min, sec, frame; - if (!PyArg_ParseTuple(args, "iii", &min, &sec, &frame)) + if (!PyArg_ParseTuple(args, "iii:msftoblock", &min, &sec, &frame)) return NULL; return PyInt_FromLong((long) CDmsftoblock(self->ob_cdplayer, @@ -196,7 +196,7 @@ CD_play(self, args) int start, play; CDSTATUS status; - if (!PyArg_ParseTuple(args, "ii", &start, &play)) + if (!PyArg_ParseTuple(args, "ii:play", &start, &play)) return NULL; if (!CDplay(self->ob_cdplayer, start, play)) { @@ -220,7 +220,7 @@ CD_playabs(self, args) int min, sec, frame, play; CDSTATUS status; - if (!PyArg_ParseTuple(args, "iiii", &min, &sec, &frame, &play)) + if (!PyArg_ParseTuple(args, "iiii:playabs", &min, &sec, &frame, &play)) return NULL; if (!CDplayabs(self->ob_cdplayer, min, sec, frame, play)) { @@ -244,7 +244,7 @@ CD_playtrack(self, args) int start, play; CDSTATUS status; - if (!PyArg_ParseTuple(args, "ii", &start, &play)) + if (!PyArg_ParseTuple(args, "ii:playtrack", &start, &play)) return NULL; if (!CDplaytrack(self->ob_cdplayer, start, play)) { @@ -268,7 +268,7 @@ CD_playtrackabs(self, args) int track, min, sec, frame, play; CDSTATUS status; - if (!PyArg_ParseTuple(args, "iiiii", &track, &min, &sec, + if (!PyArg_ParseTuple(args, "iiiii:playtrackabs", &track, &min, &sec, &frame, &play)) return NULL; @@ -293,7 +293,7 @@ CD_readda(self, args) int numframes, n; PyObject *result; - if (!PyArg_ParseTuple(args, "i", &numframes)) + if (!PyArg_ParseTuple(args, "i:readda", &numframes)) return NULL; result = PyString_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); @@ -322,7 +322,7 @@ CD_seek(self, args) int min, sec, frame; long PyTryBlock; - if (!PyArg_ParseTuple(args, "iii", &min, &sec, &frame)) + if (!PyArg_ParseTuple(args, "iii:seek", &min, &sec, &frame)) return NULL; PyTryBlock = CDseek(self->ob_cdplayer, min, sec, frame); @@ -342,7 +342,7 @@ CD_seektrack(self, args) int track; long PyTryBlock; - if (!PyArg_ParseTuple(args, "i", &track)) + if (!PyArg_ParseTuple(args, "i:seektrack", &track)) return NULL; PyTryBlock = CDseektrack(self->ob_cdplayer, track); @@ -361,7 +361,7 @@ CD_seekblock(self, args) { unsigned long PyTryBlock; - if (!PyArg_ParseTuple(args, "l", &PyTryBlock)) + if (!PyArg_ParseTuple(args, "l:seekblock", &PyTryBlock)) return NULL; PyTryBlock = CDseekblock(self->ob_cdplayer, PyTryBlock); @@ -380,7 +380,7 @@ CD_stop(self, args) { CDSTATUS status; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":stop")) return NULL; if (!CDstop(self->ob_cdplayer)) { @@ -403,7 +403,7 @@ CD_togglepause(self, args) { CDSTATUS status; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":togglepause")) return NULL; if (!CDtogglepause(self->ob_cdplayer)) { @@ -503,7 +503,7 @@ CD_open(self, args) */ dev = NULL; direction = "r"; - if (!PyArg_ParseTuple(args, "|zs", &dev, &direction)) + if (!PyArg_ParseTuple(args, "|zs:open", &dev, &direction)) return NULL; cdp = CDopen(dev, direction); @@ -605,7 +605,7 @@ CD_deleteparser(self, args) { int i; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":deleteparser")) return NULL; CDdeleteparser(self->ob_cdparser); @@ -632,7 +632,7 @@ CD_parseframe(self, args) int length; CDFRAME *p; - if (!PyArg_ParseTuple(args, "s#", &cdfp, &length)) + if (!PyArg_ParseTuple(args, "s#:parseframe", &cdfp, &length)) return NULL; if (length % sizeof(CDFRAME) != 0) { @@ -660,7 +660,7 @@ CD_removecallback(self, args) { int type; - if (!PyArg_ParseTuple(args, "i", &type)) + if (!PyArg_ParseTuple(args, "i:removecallback", &type)) return NULL; if (type < 0 || type >= NCALLBACKS) { @@ -685,7 +685,7 @@ CD_resetparser(self, args) cdparserobject *self; PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":resetparser")) return NULL; CDresetparser(self->ob_cdparser); @@ -703,7 +703,7 @@ CD_addcallback(self, args) PyObject *func, *funcarg; /* XXX - more work here */ - if (!PyArg_ParseTuple(args, "iOO", &type, &func, &funcarg)) + if (!PyArg_ParseTuple(args, "iOO:addcallback", &type, &func, &funcarg)) return NULL; if (type < 0 || type >= NCALLBACKS) { @@ -816,7 +816,7 @@ CD_createparser(self, args) { CDPARSER *cdp; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":createparser")) return NULL; cdp = CDcreateparser(); if (cdp == NULL) { @@ -833,7 +833,7 @@ CD_msftoframe(self, args) { int min, sec, frame; - if (!PyArg_ParseTuple(args, "iii", &min, &sec, &frame)) + if (!PyArg_ParseTuple(args, "iii:msftoframe", &min, &sec, &frame)) return NULL; return PyInt_FromLong((long) CDmsftoframe(min, sec, frame)); diff --git a/Modules/dbmmodule.c b/Modules/dbmmodule.c index 7a234a2..501c3f4 100644 --- a/Modules/dbmmodule.c +++ b/Modules/dbmmodule.c @@ -286,7 +286,7 @@ PyObject *args; int iflags; int mode = 0666; - if ( !PyArg_ParseTuple(args, "s|si", &name, &flags, &mode) ) + if ( !PyArg_ParseTuple(args, "s|si:open", &name, &flags, &mode) ) return NULL; if ( strcmp(flags, "r") == 0 ) iflags = O_RDONLY; diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c index 1764bca..84531b7 100644 --- a/Modules/fcntlmodule.c +++ b/Modules/fcntlmodule.c @@ -234,7 +234,7 @@ fcntl_lockf(self, args) int fd, code, ret, whence = 0; PyObject *lenobj = NULL, *startobj = NULL; - if (!PyArg_ParseTuple(args, "ii|OOi", &fd, &code, + if (!PyArg_ParseTuple(args, "ii|OOi:lockf", &fd, &code, &lenobj, &startobj, &whence)) return NULL; diff --git a/Modules/gdbmmodule.c b/Modules/gdbmmodule.c index 31855f5..96b5866 100644 --- a/Modules/gdbmmodule.c +++ b/Modules/gdbmmodule.c @@ -490,7 +490,7 @@ PyObject *args; int iflags; int mode = 0666; - if ( !PyArg_ParseTuple(args, "s|si", &name, &flags, &mode) ) + if ( !PyArg_ParseTuple(args, "s|si:open", &name, &flags, &mode) ) return NULL; switch (flags[0]) { case 'r': diff --git a/Modules/md5module.c b/Modules/md5module.c index ee11ee1..3c001ae 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -237,7 +237,7 @@ MD5_new(self, args) unsigned char *cp = NULL; int len = 0; - if (!PyArg_ParseTuple(args, "|s#", &cp, &len)) + if (!PyArg_ParseTuple(args, "|s#:new", &cp, &len)) return NULL; if ((md5p = newmd5object()) == NULL) diff --git a/Modules/newmodule.c b/Modules/newmodule.c index 786ddc5..2758f14 100644 --- a/Modules/newmodule.c +++ b/Modules/newmodule.c @@ -45,7 +45,7 @@ new_instance(unused, args) PyObject* klass; PyObject *dict; PyInstanceObject *inst; - if (!PyArg_ParseTuple(args, "O!O!", + if (!PyArg_ParseTuple(args, "O!O!:instance", &PyClass_Type, &klass, &PyDict_Type, &dict)) return NULL; @@ -71,7 +71,7 @@ new_instancemethod(unused, args) PyObject* self; PyObject* classObj; - if (!PyArg_ParseTuple(args, "OOO!", + if (!PyArg_ParseTuple(args, "OOO!:instancemethod", &func, &self, &PyClass_Type, &classObj)) @@ -105,7 +105,7 @@ new_function(unused, args) PyObject* defaults = Py_None; PyFunctionObject* newfunc; - if (!PyArg_ParseTuple(args, "O!O!|SO!", + if (!PyArg_ParseTuple(args, "O!O!|SO!:function", &PyCode_Type, &code, &PyDict_Type, &globals, &name, @@ -152,7 +152,7 @@ new_code(unused, args) PyObject* lnotab; PyBufferProcs *pb; - if (!PyArg_ParseTuple(args, "iiiiOO!O!O!SSiS", + if (!PyArg_ParseTuple(args, "iiiiOO!O!O!SSiS:code", &argcount, &nlocals, &stacksize, &flags, &code, &PyTuple_Type, &consts, @@ -188,7 +188,7 @@ new_module(unused, args) { char *name; - if (!PyArg_ParseTuple(args, "s", &name)) + if (!PyArg_ParseTuple(args, "s:module", &name)) return NULL; return PyModule_New(name); } @@ -205,7 +205,7 @@ new_class(unused, args) PyObject * classes; PyObject * dict; - if (!PyArg_ParseTuple(args, "SO!O!", &name, &PyTuple_Type, &classes, + if (!PyArg_ParseTuple(args, "SO!O!:class", &name, &PyTuple_Type, &classes, &PyDict_Type, &dict)) return NULL; return PyClass_New(classes, dict, name); diff --git a/Modules/pcremodule.c b/Modules/pcremodule.c index 6f6b910..f44726e 100644 --- a/Modules/pcremodule.c +++ b/Modules/pcremodule.c @@ -109,7 +109,7 @@ PyPcre_exec(self, args) int offsets[100*2]; PyObject *list; - if (!PyArg_ParseTuple(args, "t#|iiii", &string, &stringlen, &pos, &endpos, &options)) + if (!PyArg_ParseTuple(args, "t#|iiii:match", &string, &stringlen, &pos, &endpos, &options)) return NULL; if (endpos == -1) {endpos = stringlen;} count = pcre_exec(self->regex, self->regex_extra, @@ -193,7 +193,7 @@ PyPcre_compile(self, args) const char *error; int options, erroroffset; - if (!PyArg_ParseTuple(args, "siO!", &pattern, &options, + if (!PyArg_ParseTuple(args, "siO!:pcre_compile", &pattern, &options, &PyDict_Type, &dictionary)) return NULL; rv = newPcreObject(args); @@ -471,7 +471,7 @@ PyPcre_expand(self, args) unsigned char *repl; int size, total_len, i, start, pos; - if (!PyArg_ParseTuple(args, "OS", &match_obj, &repl_obj)) + if (!PyArg_ParseTuple(args, "OS:pcre_expand", &match_obj, &repl_obj)) return NULL; repl=(unsigned char *)PyString_AsString(repl_obj); diff --git a/Modules/puremodule.c b/Modules/puremodule.c index ee80a2f..a8ada75 100644 --- a/Modules/puremodule.c +++ b/Modules/puremodule.c @@ -321,7 +321,7 @@ pure_purify_set_pool_id(self, args) long memrep; int id; - if (!PyArg_ParseTuple(args, "li", &memrep, &id)) + if (!PyArg_ParseTuple(args, "li:purify_set_pool_id", &memrep, &id)) return NULL; purify_set_pool_id((char*)memrep, id); @@ -343,7 +343,7 @@ pure_purify_set_user_data(self, args) long memrep; long datarep; - if (!PyArg_ParseTuple(args, "ll", &memrep, &datarep)) + if (!PyArg_ParseTuple(args, "ll:purify_set_user_data", &memrep, &datarep)) return NULL; purify_set_user_data((char*)memrep, (void*)datarep); @@ -361,7 +361,7 @@ pure_purify_get_user_data(self, args) long memrep; void* data; - if (!PyArg_ParseTuple(args, "l", &memrep)) + if (!PyArg_ParseTuple(args, "l:purify_get_user_data", &memrep)) return NULL; data = purify_get_user_data((char*)memrep); @@ -411,7 +411,7 @@ pure_purify_map_pool(self, args) PyObject* arg_callable; int id; - if (!PyArg_ParseTuple(args, "iO", &id, &arg_callable)) + if (!PyArg_ParseTuple(args, "iO:purify_map_pool", &id, &arg_callable)) return NULL; if (!PyCallable_Check(arg_callable)) { @@ -451,7 +451,7 @@ pure_purify_map_pool_id(self, args) PyObject* saved_callable = MapCallable; PyObject* arg_callable; - if (!PyArg_ParseTuple(args, "O", &arg_callable)) + if (!PyArg_ParseTuple(args, "O:purify_map_pool_id", &arg_callable)) return NULL; if (!PyCallable_Check(arg_callable)) { @@ -530,7 +530,7 @@ pure_purify_name_thread(self, args) int status; char* stringarg; - if (!PyArg_ParseTuple(args, "s", &stringarg)) + if (!PyArg_ParseTuple(args, "s:purify_name_thread", &stringarg)) return NULL; status = purify_name_thread(stringarg); @@ -666,7 +666,7 @@ pure_purify_watch_n(self, args) char* type; int status; - if (!PyArg_ParseTuple(args, "lis", &addrrep, &size, &type)) + if (!PyArg_ParseTuple(args, "lis:purify_watch_n", &addrrep, &size, &type)) return NULL; status = purify_watch_n((char*)addrrep, size, type); @@ -689,7 +689,7 @@ pure_purify_watch_remove(self, args) int watchno; int status; - if (!PyArg_ParseTuple(args, "i", &watchno)) + if (!PyArg_ParseTuple(args, "i:purify_watch_remove", &watchno)) return NULL; status = purify_watch_remove(watchno); @@ -711,7 +711,7 @@ pure_purify_describe(self, args) long addrrep; char* rtn; - if (!PyArg_ParseTuple(args, "l", &addrrep)) + if (!PyArg_ParseTuple(args, "l:purify_describe", &addrrep)) return NULL; rtn = purify_describe((char*)addrrep); @@ -727,7 +727,7 @@ pure_purify_what_colors(self, args) unsigned int size; int status; - if (!PyArg_ParseTuple(args, "li", &addrrep, &size)) + if (!PyArg_ParseTuple(args, "li:purify_what_colors", &addrrep, &size)) return NULL; status = purify_what_colors((char*)addrrep, size); @@ -772,7 +772,7 @@ pure_purify_exit(self, args) { int status; - if (!PyArg_ParseTuple(args, "i", &status)) + if (!PyArg_ParseTuple(args, "i:purify_exit", &status)) return NULL; /* purify_exit doesn't always act like exit(). See the manual */ diff --git a/Modules/readline.c b/Modules/readline.c index 68f3cf6..d4ba3f8 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -50,7 +50,7 @@ parse_and_bind(self, args) PyObject *args; { char *s, *copy; - if (!PyArg_ParseTuple(args, "s", &s)) + if (!PyArg_ParseTuple(args, "s:parse_and_bind", &s)) return NULL; /* Make a copy -- rl_parse_and_bind() modifies its argument */ /* Bernard Herzog */ @@ -78,7 +78,7 @@ read_init_file(self, args) PyObject *args; { char *s = NULL; - if (!PyArg_ParseTuple(args, "|z", &s)) + if (!PyArg_ParseTuple(args, "|z:read_init_file", &s)) return NULL; errno = rl_read_init_file(s); if (errno) @@ -146,7 +146,7 @@ set_completer_delims(self, args) { char *break_chars; - if(!PyArg_ParseTuple(args, "s", &break_chars)) { + if(!PyArg_ParseTuple(args, "s:set_completer_delims", &break_chars)) { return NULL; } free(rl_completer_word_break_characters); @@ -183,7 +183,7 @@ set_completer(self, args) PyObject *args; { PyObject *function = Py_None; - if (!PyArg_ParseTuple(args, "|O", &function)) + if (!PyArg_ParseTuple(args, "|O:set_completer", &function)) return NULL; if (function == Py_None) { Py_XDECREF(completer); @@ -239,7 +239,7 @@ insert_text(self, args) PyObject *args; { char *s; - if (!PyArg_ParseTuple(args, "s", &s)) + if (!PyArg_ParseTuple(args, "s:insert_text", &s)) return NULL; rl_insert_text(s); Py_INCREF(Py_None); diff --git a/Modules/regexmodule.c b/Modules/regexmodule.c index 1f64f61..4fbf5c8 100644 --- a/Modules/regexmodule.c +++ b/Modules/regexmodule.c @@ -119,7 +119,7 @@ regobj_match(re, args) int offset = 0; int result; - if (!PyArg_ParseTuple(args, "O|i", &argstring, &offset)) + if (!PyArg_ParseTuple(args, "O|i:match", &argstring, &offset)) return NULL; if (!PyArg_Parse(argstring, "t#", &buffer, &size)) return NULL; @@ -158,9 +158,9 @@ regobj_search(re, args) int range; int result; - if (!PyArg_ParseTuple(args, "O|i", &argstring, &offset)) + if (!PyArg_ParseTuple(args, "O|i:search", &argstring, &offset)) return NULL; - if (!PyArg_Parse(argstring, "t#", &buffer, &size)) + if (!PyArg_Parse(argstring, "t#:search", &buffer, &size)) return NULL; if (offset < 0 || offset > size) { @@ -459,7 +459,7 @@ regex_compile(self, args) PyObject *pat = NULL; PyObject *tran = NULL; - if (!PyArg_ParseTuple(args, "S|S", &pat, &tran)) + if (!PyArg_ParseTuple(args, "S|S:compile", &pat, &tran)) return NULL; return newregexobject(pat, tran, pat, NULL); } @@ -584,7 +584,7 @@ regex_symcomp(self, args) PyObject *npattern; PyObject *retval = NULL; - if (!PyArg_ParseTuple(args, "S|S", &pattern, &tran)) + if (!PyArg_ParseTuple(args, "S|S:symcomp", &pattern, &tran)) return NULL; gdict = PyDict_New(); diff --git a/Modules/resource.c b/Modules/resource.c index 4e1c2b1..2c825c7 100644 --- a/Modules/resource.c +++ b/Modules/resource.c @@ -60,7 +60,7 @@ resource_getrusage(self, args) int who; struct rusage ru; - if (!PyArg_ParseTuple(args, "i", &who)) + if (!PyArg_ParseTuple(args, "i:getrusage", &who)) return NULL; if (getrusage(who, &ru) == -1) { @@ -107,7 +107,7 @@ resource_getrlimit(self, args) struct rlimit rl; int resource; - if (!PyArg_ParseTuple(args, "i", &resource)) + if (!PyArg_ParseTuple(args, "i:getrlimit", &resource)) return NULL; if (resource < 0 || resource >= RLIM_NLIMITS) { @@ -140,7 +140,7 @@ resource_setrlimit(self, args) int resource; PyObject *curobj, *maxobj; - if (!PyArg_ParseTuple(args, "i(OO)", &resource, &curobj, &maxobj)) + if (!PyArg_ParseTuple(args, "i(OO):setrlimit", &resource, &curobj, &maxobj)) return NULL; if (resource < 0 || resource >= RLIM_NLIMITS) { @@ -182,7 +182,7 @@ resource_getpagesize(self, args) PyObject *self; PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":getpagesize")) return NULL; return Py_BuildValue("i", getpagesize()); } diff --git a/Modules/rotormodule.c b/Modules/rotormodule.c index b3511d8..b1fef39 100644 --- a/Modules/rotormodule.c +++ b/Modules/rotormodule.c @@ -583,7 +583,7 @@ rotorobj_setkey(self, args) { char *key; - if (!PyArg_ParseTuple(args, "s", &key)) + if (!PyArg_ParseTuple(args, "s:setkey", &key)) return NULL; set_key(self, key); @@ -639,7 +639,7 @@ rotor_rotor(self, args) int len; int num_rotors = 6; - if (!PyArg_ParseTuple(args, "s#|i", &string, &len, &num_rotors)) + if (!PyArg_ParseTuple(args, "s#|i:newrotor", &string, &len, &num_rotors)) return NULL; r = rotorobj_new(num_rotors, string); diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 3e018dd..b48eb54 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -243,7 +243,7 @@ select_select(self, args) int n; /* convert arguments */ - if (!PyArg_ParseTuple(args, "OOO|O", + if (!PyArg_ParseTuple(args, "OOO|O:select", &ifdlist, &ofdlist, &efdlist, &tout)) return NULL; diff --git a/Modules/shamodule.c b/Modules/shamodule.c index 76b95b2..0504fad 100644 --- a/Modules/shamodule.c +++ b/Modules/shamodule.c @@ -548,7 +548,7 @@ SHA_new(self, args, kwdict) if ((new = newSHAobject()) == NULL) return NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s#", kwlist, + if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s#:new", kwlist, &cp, &len)) { Py_DECREF(new); return NULL; diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 5e63e53..3f8aa19 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1096,7 +1096,7 @@ BUILD_FUNC_DEF_2(PySocketSock_makefile,PySocketSockObject *,s, PyObject *,args) FILE *fp; PyObject *f; - if (!PyArg_ParseTuple(args, "|si", &mode, &bufsize)) + if (!PyArg_ParseTuple(args, "|si:makefile", &mode, &bufsize)) return NULL; #ifdef MS_WIN32 if (((fd = _open_osfhandle(s->sock_fd, _O_BINARY)) < 0) || @@ -1131,7 +1131,7 @@ BUILD_FUNC_DEF_2(PySocketSock_recv,PySocketSockObject *,s, PyObject *,args) { int len, n, flags = 0; PyObject *buf; - if (!PyArg_ParseTuple(args, "i|i", &len, &flags)) + if (!PyArg_ParseTuple(args, "i|i:recv", &len, &flags)) return NULL; buf = PyString_FromStringAndSize((char *) 0, len); if (buf == NULL) @@ -1168,7 +1168,7 @@ BUILD_FUNC_DEF_2(PySocketSock_recvfrom,PySocketSockObject *,s, PyObject *,args) PyObject *ret = NULL; int addrlen, len, n, flags = 0; - if (!PyArg_ParseTuple(args, "i|i", &len, &flags)) + if (!PyArg_ParseTuple(args, "i|i:recvfrom", &len, &flags)) return NULL; if (!getsockaddrlen(s, &addrlen)) return NULL; @@ -1218,7 +1218,7 @@ BUILD_FUNC_DEF_2(PySocketSock_send,PySocketSockObject *,s, PyObject *,args) { char *buf; int len, n, flags = 0; - if (!PyArg_ParseTuple(args, "s#|i", &buf, &len, &flags)) + if (!PyArg_ParseTuple(args, "s#|i:send", &buf, &len, &flags)) return NULL; Py_BEGIN_ALLOW_THREADS n = send(s->sock_fd, buf, len, flags); @@ -1702,7 +1702,7 @@ BUILD_FUNC_DEF_2(PySocket_socket,PyObject *,self, PyObject *,args) int fd; #endif int family, type, proto = 0; - if (!PyArg_ParseTuple(args, "ii|i", &family, &type, &proto)) + if (!PyArg_ParseTuple(args, "ii|i:socket", &family, &type, &proto)) return NULL; Py_BEGIN_ALLOW_THREADS fd = socket(family, type, proto); @@ -1747,7 +1747,7 @@ BUILD_FUNC_DEF_2(PySocket_fromfd,PyObject *,self, PyObject *,args) { PySocketSockObject *s; int fd, family, type, proto = 0; - if (!PyArg_ParseTuple(args, "iii|i", &fd, &family, &type, &proto)) + if (!PyArg_ParseTuple(args, "iii|i:fromfd", &fd, &family, &type, &proto)) return NULL; /* Dup the fd so it and the socket can be closed independently */ fd = dup(fd); @@ -2015,7 +2015,7 @@ BUILD_FUNC_DEF_2(PySocket_ssl, PyObject *, self, PyObject *, args) char *key_file; char *cert_file; - if (!PyArg_ParseTuple(args, "O!zz", + if (!PyArg_ParseTuple(args, "O!zz:ssl", &PySocketSock_Type, (PyObject*)&Sock, &key_file, &cert_file) ) return NULL; @@ -2094,7 +2094,7 @@ static PyObject *SSL_SSLwrite(SSLObject *self, PyObject *args) char *data; int len = 0; - if (!PyArg_ParseTuple(args, "s|i", &data, &len)) + if (!PyArg_ParseTuple(args, "s|i:write", &data, &len)) return NULL; if (!len) @@ -2111,7 +2111,7 @@ static PyObject *SSL_SSLread(SSLObject *self, PyObject *args) int len = 1024; int res; - PyArg_ParseTuple(args, "|i", &len); + PyArg_ParseTuple(args, "|i:read", &len); if (!(buf = PyString_FromStringAndSize((char *) 0, len))) return NULL; /* Error object should already be set */ diff --git a/Modules/soundex.c b/Modules/soundex.c index 3ef6824..e905fe0 100644 --- a/Modules/soundex.c +++ b/Modules/soundex.c @@ -125,7 +125,7 @@ get_soundex(PyObject *self, PyObject *args) char *str; char sdx[7]; - if(!PyArg_ParseTuple( args, "s", &str)) + if(!PyArg_ParseTuple( args, "s:get_soundex", &str)) return NULL; soundex_hash(str, sdx); @@ -141,7 +141,7 @@ sound_similar(PyObject *self, PyObject *args) char *str1, *str2; char res1[7], res2[7]; - if(!PyArg_ParseTuple(args, "ss", &str1, &str2)) + if(!PyArg_ParseTuple(args, "ss:sound_similar", &str1, &str2)) return NULL; soundex_hash(str1, res1); diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c index 7a56e37..a0d8b9a 100644 --- a/Modules/stropmodule.c +++ b/Modules/stropmodule.c @@ -141,7 +141,7 @@ strop_splitfields(self, args) n = 0; splitcount = 0; maxsplit = 0; - if (!PyArg_ParseTuple(args, "t#|z#i", &s, &len, &sub, &n, &maxsplit)) + if (!PyArg_ParseTuple(args, "t#|z#i:split", &s, &len, &sub, &n, &maxsplit)) return NULL; if (sub == NULL) return split_whitespace(s, len, maxsplit); @@ -211,7 +211,7 @@ strop_joinfields(self, args) char* p = NULL; intargfunc getitemfunc; - if (!PyArg_ParseTuple(args, "O|t#", &seq, &sep, &seplen)) + if (!PyArg_ParseTuple(args, "O|t#:join", &seq, &sep, &seplen)) return NULL; if (sep == NULL) { sep = " "; @@ -338,7 +338,7 @@ strop_find(self, args) char *s, *sub; int len, n, i = 0, last = INT_MAX; - if (!PyArg_ParseTuple(args, "t#t#|ii", &s, &len, &sub, &n, &i, &last)) + if (!PyArg_ParseTuple(args, "t#t#|ii:find", &s, &len, &sub, &n, &i, &last)) return NULL; if (last > len) @@ -383,7 +383,7 @@ strop_rfind(self, args) int len, n, j; int i = 0, last = INT_MAX; - if (!PyArg_ParseTuple(args, "t#t#|ii", &s, &len, &sub, &n, &i, &last)) + if (!PyArg_ParseTuple(args, "t#t#|ii:rfind", &s, &len, &sub, &n, &i, &last)) return NULL; if (last > len) @@ -642,7 +642,7 @@ strop_expandtabs(self, args) int tabsize = 8; /* Get arguments */ - if (!PyArg_ParseTuple(args, "s#|i", &string, &stringlen, &tabsize)) + if (!PyArg_ParseTuple(args, "s#|i:expandtabs", &string, &stringlen, &tabsize)) return NULL; if (tabsize < 1) { PyErr_SetString(PyExc_ValueError, @@ -708,7 +708,7 @@ strop_count(self, args) int i = 0, last = INT_MAX; int m, r; - if (!PyArg_ParseTuple(args, "t#t#|ii", &s, &len, &sub, &n, &i, &last)) + if (!PyArg_ParseTuple(args, "t#t#|ii:count", &s, &len, &sub, &n, &i, &last)) return NULL; if (last > len) last = len; @@ -803,7 +803,7 @@ strop_atoi(self, args) long x; char buffer[256]; /* For errors */ - if (!PyArg_ParseTuple(args, "s|i", &s, &base)) + if (!PyArg_ParseTuple(args, "s|i:atoi", &s, &base)) return NULL; if ((base != 0 && base < 2) || base > 36) { @@ -858,7 +858,7 @@ strop_atol(self, args) PyObject *x; char buffer[256]; /* For errors */ - if (!PyArg_ParseTuple(args, "s|i", &s, &base)) + if (!PyArg_ParseTuple(args, "s|i:atol", &s, &base)) return NULL; if ((base != 0 && base < 2) || base > 36) { @@ -904,7 +904,7 @@ strop_atof(self, args) double x; char buffer[256]; /* For errors */ - if (!PyArg_ParseTuple(args, "s", &s)) + if (!PyArg_ParseTuple(args, "s:atof", &s)) return NULL; while (*s && isspace(Py_CHARMASK(*s))) s++; @@ -948,7 +948,7 @@ strop_maketrans(self, args) int i, fromlen=0, tolen=0; PyObject *result; - if (!PyArg_ParseTuple(args, "t#t#", &from, &fromlen, &to, &tolen)) + if (!PyArg_ParseTuple(args, "t#t#:maketrans", &from, &fromlen, &to, &tolen)) return NULL; if (fromlen != tolen) { @@ -991,7 +991,7 @@ strop_translate(self, args) PyObject *result; int trans_table[256]; - if (!PyArg_ParseTuple(args, "St#|t#", &input_obj, + if (!PyArg_ParseTuple(args, "St#|t#:translate", &input_obj, &table1, &tablen, &del_table, &dellen)) return NULL; if (tablen != 256) { @@ -1205,7 +1205,7 @@ strop_replace(self, args) int count = 0; PyObject *new; - if (!PyArg_ParseTuple(args, "t#t#t#|i", + if (!PyArg_ParseTuple(args, "t#t#t#|i:replace", &str, &len, &pat, &pat_len, &sub, &sub_len, &count)) return NULL; diff --git a/Modules/structmodule.c b/Modules/structmodule.c index 9994d20..0a706a9 100644 --- a/Modules/structmodule.c +++ b/Modules/structmodule.c @@ -1097,7 +1097,7 @@ struct_calcsize(self, args) const formatdef *f; int size; - if (!PyArg_ParseTuple(args, "s", &fmt)) + if (!PyArg_ParseTuple(args, "s:calcsize", &fmt)) return NULL; f = whichtable(&fmt); size = calcsize(fmt, f); @@ -1262,7 +1262,7 @@ struct_unpack(self, args) int len, size, num; PyObject *res, *v; - if (!PyArg_ParseTuple(args, "ss#", &fmt, &start, &len)) + if (!PyArg_ParseTuple(args, "ss#:unpack", &fmt, &start, &len)) return NULL; f = whichtable(&fmt); size = calcsize(fmt, f); diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c index 60889b1..6f192c3 100644 --- a/Modules/syslogmodule.c +++ b/Modules/syslogmodule.c @@ -105,7 +105,7 @@ syslog_closelog(self, args) PyObject * self; PyObject * args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":closelog")) return NULL; closelog(); Py_XDECREF(S_ident_o); @@ -134,7 +134,7 @@ syslog_log_mask(self, args) { long mask; long pri; - if (!PyArg_ParseTuple(args, "l", &pri)) + if (!PyArg_ParseTuple(args, "l:LOG_MASK", &pri)) return NULL; mask = LOG_MASK(pri); return PyInt_FromLong(mask); @@ -147,7 +147,7 @@ syslog_log_upto(self, args) { long mask; long pri; - if (!PyArg_ParseTuple(args, "l", &pri)) + if (!PyArg_ParseTuple(args, "l:LOG_UPTO", &pri)) return NULL; mask = LOG_UPTO(pri); return PyInt_FromLong(mask); diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c index 3d5e4cc..cb463d9 100644 --- a/Modules/threadmodule.c +++ b/Modules/threadmodule.c @@ -251,7 +251,7 @@ thread_PyThread_start_new_thread(self, fargs) PyObject *func, *args = NULL, *keyw = NULL; struct bootstate *boot; - if (!PyArg_ParseTuple(fargs, "OO|O", &func, &args, &keyw)) + if (!PyArg_ParseTuple(fargs, "OO|O:start_new_thread", &func, &args, &keyw)) return NULL; if (!PyCallable_Check(func)) { PyErr_SetString(PyExc_TypeError, diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 1d0fc3c..392f2b9 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -373,7 +373,7 @@ time_strftime(self, args) memset((ANY *) &buf, '\0', sizeof(buf)); - if (!PyArg_ParseTuple(args, "sO", &fmt, &tup) || !gettmarg(tup, &buf)) + if (!PyArg_ParseTuple(args, "sO:strftime", &fmt, &tup) || !gettmarg(tup, &buf)) return NULL; fmtlen = strlen(fmt); @@ -421,7 +421,7 @@ time_strptime(self, args) char *buf; char *s; - if (!PyArg_ParseTuple(args, "s|s", &buf, &fmt)) { + if (!PyArg_ParseTuple(args, "s|s:strptime", &buf, &fmt)) { PyErr_SetString(PyExc_ValueError, "invalid argument"); return NULL; } @@ -455,7 +455,7 @@ time_asctime(self, args) PyObject *tup; struct tm buf; char *p; - if (!PyArg_ParseTuple(args, "O", &tup)) + if (!PyArg_ParseTuple(args, "O:asctime", &tup)) return NULL; if (!gettmarg(tup, &buf)) return NULL; @@ -506,7 +506,7 @@ time_mktime(self, args) PyObject *tup; struct tm buf; time_t tt; - if (!PyArg_ParseTuple(args, "O", &tup)) + if (!PyArg_ParseTuple(args, "O:mktime", &tup)) return NULL; tt = time(&tt); buf = *localtime(&tt); diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c index 04a474c..c0d05f4 100644 --- a/Modules/xxmodule.c +++ b/Modules/xxmodule.c @@ -84,7 +84,7 @@ Xxo_demo(self, args) XxoObject *self; PyObject *args; { - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":demo")) return NULL; Py_INCREF(Py_None); return Py_None; @@ -163,7 +163,7 @@ xx_foo(self, args) { long i, j; long res; - if (!PyArg_ParseTuple(args, "ll", &i, &j)) + if (!PyArg_ParseTuple(args, "ll:foo", &i, &j)) return NULL; res = i+j; /* XXX Do something here */ return PyInt_FromLong(res); @@ -179,7 +179,7 @@ xx_new(self, args) { XxoObject *rv; - if (!PyArg_ParseTuple(args, "")) + if (!PyArg_ParseTuple(args, ":new")) return NULL; rv = newXxoObject(args); if ( rv == NULL ) @@ -196,7 +196,7 @@ xx_bug(self, args) { PyObject *list, *item; - if (!PyArg_ParseTuple(args, "O", &list)) + if (!PyArg_ParseTuple(args, "O:bug", &list)) return NULL; item = PyList_GetItem(list, 0); @@ -219,7 +219,7 @@ xx_roj(self, args) { PyObject *a; long b; - if (!PyArg_ParseTuple(args, "O#", &a, &b)) + if (!PyArg_ParseTuple(args, "O#:roj", &a, &b)) return NULL; Py_INCREF(Py_None); return Py_None; diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 8286339..aaecc11 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -74,7 +74,7 @@ PyZlib_compress(self, args) int length, level=Z_DEFAULT_COMPRESSION, err; z_stream zst; - if (!PyArg_ParseTuple(args, "s#|i", &input, &length, &level)) + if (!PyArg_ParseTuple(args, "s#|i:compress", &input, &length, &level)) return NULL; zst.avail_out = length + length/1000 + 12 + 1; output=(Byte*)malloc(zst.avail_out); @@ -172,7 +172,7 @@ PyZlib_decompress(self, args) int length, err; int wsize=DEF_WBITS, r_strlen=DEFAULTALLOC; z_stream zst; - if (!PyArg_ParseTuple(args, "s#|ii", &input, &length, &wsize, &r_strlen)) + if (!PyArg_ParseTuple(args, "s#|ii:decompress", &input, &length, &wsize, &r_strlen)) return NULL; if (r_strlen <= 0) @@ -278,7 +278,7 @@ PyZlib_compressobj(selfptr, args) int level=Z_DEFAULT_COMPRESSION, method=DEFLATED; int wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=0, err; - if (!PyArg_ParseTuple(args, "|iiiii", &level, &method, &wbits, + if (!PyArg_ParseTuple(args, "|iiiii:compressobj", &level, &method, &wbits, &memLevel, &strategy)) return NULL; @@ -325,7 +325,7 @@ PyZlib_decompressobj(selfptr, args) { int wbits=DEF_WBITS, err; compobject *self; - if (!PyArg_ParseTuple(args, "|i", &wbits)) + if (!PyArg_ParseTuple(args, "|i:decompressobj", &wbits)) { return NULL; } @@ -403,7 +403,7 @@ PyZlib_objcompress(self, args) Byte *input; unsigned long start_total_out; - if (!PyArg_ParseTuple(args, "s#", &input, &inplen)) + if (!PyArg_ParseTuple(args, "s#:compress", &input, &inplen)) return NULL; self->zst.avail_in = inplen; self->zst.next_in = input; @@ -461,7 +461,7 @@ PyZlib_objdecompress(self, args) Byte *input; unsigned long start_total_out; - if (!PyArg_ParseTuple(args, "s#", &input, &inplen)) + if (!PyArg_ParseTuple(args, "s#:decompress", &input, &inplen)) return NULL; start_total_out = self->zst.total_out; RetVal = PyString_FromStringAndSize(NULL, DEFAULTALLOC); @@ -535,7 +535,7 @@ PyZlib_flush(self, args) int flushmode = Z_FINISH; unsigned long start_total_out; - if (!PyArg_ParseTuple(args, "|i", &flushmode)) + if (!PyArg_ParseTuple(args, "|i:flush", &flushmode)) return NULL; /* Flushing with Z_NO_FLUSH is a no-op, so there's no point in @@ -745,7 +745,7 @@ PyZlib_adler32(self, args) Byte *buf; int len; - if (!PyArg_ParseTuple(args, "s#|l", &buf, &len, &adler32val)) + if (!PyArg_ParseTuple(args, "s#|l:adler32", &buf, &len, &adler32val)) { return NULL; } @@ -767,7 +767,7 @@ PyZlib_crc32(self, args) uLong crc32val=crc32(0L, Z_NULL, 0); Byte *buf; int len; - if (!PyArg_ParseTuple(args, "s#|l", &buf, &len, &crc32val)) + if (!PyArg_ParseTuple(args, "s#|l:crc32", &buf, &len, &crc32val)) { return NULL; } |