Massive patch by Skip Montanaro to add ":name" to as many

PyArg_ParseTuple() format string arguments as possible.
This commit is contained in:
Guido van Rossum 2000-02-29 13:59:29 +00:00
parent a9b2b4be26
commit 43713e5a28
37 changed files with 272 additions and 272 deletions

View File

@ -135,7 +135,7 @@ PyLocale_setlocale(self,args)
char *locale=0,*result; char *locale=0,*result;
PyObject *result_object; PyObject *result_object;
struct lconv *lc; 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){ if(locale){
/* set locale */ /* set locale */
result=setlocale(category,locale); result=setlocale(category,locale);
@ -266,7 +266,7 @@ PyLocale_strcoll(self,args)
PyObject *args; PyObject *args;
{ {
char *s1,*s2; char *s1,*s2;
if(!PyArg_ParseTuple(args,"ss",&s1,&s2)) if(!PyArg_ParseTuple(args,"ss:strcoll",&s1,&s2))
return NULL; return NULL;
return PyInt_FromLong(strcoll(s1,s2)); return PyInt_FromLong(strcoll(s1,s2));
} }
@ -283,7 +283,7 @@ PyLocale_strxfrm(self,args)
char *s,*buf; char *s,*buf;
int n1,n2; int n1,n2;
PyObject *result; PyObject *result;
if(!PyArg_ParseTuple(args,"s",&s)) if(!PyArg_ParseTuple(args,"s:strxfrm",&s))
return NULL; return NULL;
/* assume no change in size, first */ /* assume no change in size, first */
n1=strlen(s)+1; n1=strlen(s)+1;

View File

@ -697,7 +697,7 @@ Tkapp_Eval(self, args)
PyObject *res = NULL; PyObject *res = NULL;
int err; int err;
if (!PyArg_ParseTuple(args, "s", &script)) if (!PyArg_ParseTuple(args, "s:eval", &script))
return NULL; return NULL;
ENTER_TCL ENTER_TCL
@ -720,7 +720,7 @@ Tkapp_GlobalEval(self, args)
PyObject *res = NULL; PyObject *res = NULL;
int err; int err;
if (!PyArg_ParseTuple(args, "s", &script)) if (!PyArg_ParseTuple(args, "s:globaleval", &script))
return NULL; return NULL;
ENTER_TCL ENTER_TCL
@ -743,7 +743,7 @@ Tkapp_EvalFile(self, args)
PyObject *res = NULL; PyObject *res = NULL;
int err; int err;
if (!PyArg_ParseTuple(args, "s", &fileName)) if (!PyArg_ParseTuple(args, "s:evalfile", &fileName))
return NULL; return NULL;
ENTER_TCL ENTER_TCL
@ -788,7 +788,7 @@ Tkapp_AddErrorInfo(self, args)
{ {
char *msg; char *msg;
if (!PyArg_ParseTuple(args, "s", &msg)) if (!PyArg_ParseTuple(args, "s:adderrorinfo", &msg))
return NULL; return NULL;
ENTER_TCL ENTER_TCL
Tcl_AddErrorInfo(Tkapp_Interp(self), msg); Tcl_AddErrorInfo(Tkapp_Interp(self), msg);
@ -816,7 +816,7 @@ SetVar(self, args, flags)
if (!tmp) if (!tmp)
return NULL; return NULL;
if (PyArg_ParseTuple(args, "sO", &name1, &newValue)) { if (PyArg_ParseTuple(args, "sO:setvar", &name1, &newValue)) {
/* XXX Merge? */ /* XXX Merge? */
s = AsString(newValue, tmp); s = AsString(newValue, tmp);
ENTER_TCL ENTER_TCL
@ -825,7 +825,7 @@ SetVar(self, args, flags)
} }
else { else {
PyErr_Clear(); PyErr_Clear();
if (PyArg_ParseTuple(args, "ssO", &name1, &name2, &newValue)) { if (PyArg_ParseTuple(args, "ssO:setvar", &name1, &name2, &newValue)) {
s = AsString (newValue, tmp); s = AsString (newValue, tmp);
ENTER_TCL ENTER_TCL
ok = Tcl_SetVar2(Tkapp_Interp(self), name1, name2, ok = Tcl_SetVar2(Tkapp_Interp(self), name1, name2,
@ -873,7 +873,7 @@ GetVar(self, args, flags)
char *name1, *name2=NULL, *s; char *name1, *name2=NULL, *s;
PyObject *res = NULL; PyObject *res = NULL;
if (!PyArg_ParseTuple(args, "s|s", &name1, &name2)) if (!PyArg_ParseTuple(args, "s|s:getvar", &name1, &name2))
return NULL; return NULL;
ENTER_TCL ENTER_TCL
if (name2 == NULL) if (name2 == NULL)
@ -919,7 +919,7 @@ UnsetVar(self, args, flags)
PyObject *res = NULL; PyObject *res = NULL;
int code; int code;
if (!PyArg_ParseTuple(args, "s|s", &name1, &name2)) if (!PyArg_ParseTuple(args, "s|s:unsetvar", &name1, &name2))
return NULL; return NULL;
ENTER_TCL ENTER_TCL
if (name2 == NULL) if (name2 == NULL)
@ -967,7 +967,7 @@ Tkapp_GetInt(self, args)
char *s; char *s;
int v; int v;
if (!PyArg_ParseTuple(args, "s", &s)) if (!PyArg_ParseTuple(args, "s:getint", &s))
return NULL; return NULL;
if (Tcl_GetInt(Tkapp_Interp(self), s, &v) == TCL_ERROR) if (Tcl_GetInt(Tkapp_Interp(self), s, &v) == TCL_ERROR)
return Tkinter_Error(self); return Tkinter_Error(self);
@ -982,7 +982,7 @@ Tkapp_GetDouble(self, args)
char *s; char *s;
double v; double v;
if (!PyArg_ParseTuple(args, "s", &s)) if (!PyArg_ParseTuple(args, "s:getdouble", &s))
return NULL; return NULL;
if (Tcl_GetDouble(Tkapp_Interp(self), s, &v) == TCL_ERROR) if (Tcl_GetDouble(Tkapp_Interp(self), s, &v) == TCL_ERROR)
return Tkinter_Error(self); return Tkinter_Error(self);
@ -997,7 +997,7 @@ Tkapp_GetBoolean(self, args)
char *s; char *s;
int v; int v;
if (!PyArg_ParseTuple(args, "s", &s)) if (!PyArg_ParseTuple(args, "s:getboolean", &s))
return NULL; return NULL;
if (Tcl_GetBoolean(Tkapp_Interp(self), s, &v) == TCL_ERROR) if (Tcl_GetBoolean(Tkapp_Interp(self), s, &v) == TCL_ERROR)
return Tkinter_Error(self); return Tkinter_Error(self);
@ -1013,7 +1013,7 @@ Tkapp_ExprString(self, args)
PyObject *res = NULL; PyObject *res = NULL;
int retval; int retval;
if (!PyArg_ParseTuple(args, "s", &s)) if (!PyArg_ParseTuple(args, "s:exprstring", &s))
return NULL; return NULL;
ENTER_TCL ENTER_TCL
retval = Tcl_ExprString(Tkapp_Interp(self), s); retval = Tcl_ExprString(Tkapp_Interp(self), s);
@ -1036,7 +1036,7 @@ Tkapp_ExprLong(self, args)
int retval; int retval;
long v; long v;
if (!PyArg_ParseTuple(args, "s", &s)) if (!PyArg_ParseTuple(args, "s:exprlong", &s))
return NULL; return NULL;
ENTER_TCL ENTER_TCL
retval = Tcl_ExprLong(Tkapp_Interp(self), s, &v); retval = Tcl_ExprLong(Tkapp_Interp(self), s, &v);
@ -1059,7 +1059,7 @@ Tkapp_ExprDouble(self, args)
double v; double v;
int retval; int retval;
if (!PyArg_ParseTuple(args, "s", &s)) if (!PyArg_ParseTuple(args, "s:exprdouble", &s))
return NULL; return NULL;
PyFPE_START_PROTECT("Tkapp_ExprDouble", return 0) PyFPE_START_PROTECT("Tkapp_ExprDouble", return 0)
ENTER_TCL ENTER_TCL
@ -1084,7 +1084,7 @@ Tkapp_ExprBoolean(self, args)
int retval; int retval;
int v; int v;
if (!PyArg_ParseTuple(args, "s", &s)) if (!PyArg_ParseTuple(args, "s:exprboolean", &s))
return NULL; return NULL;
ENTER_TCL ENTER_TCL
retval = Tcl_ExprBoolean(Tkapp_Interp(self), s, &v); retval = Tcl_ExprBoolean(Tkapp_Interp(self), s, &v);
@ -1110,7 +1110,7 @@ Tkapp_SplitList(self, args)
PyObject *v; PyObject *v;
int i; int i;
if (!PyArg_ParseTuple(args, "s", &list)) if (!PyArg_ParseTuple(args, "s:splitlist", &list))
return NULL; return NULL;
if (Tcl_SplitList(Tkapp_Interp(self), list, &argc, &argv) == TCL_ERROR) if (Tcl_SplitList(Tkapp_Interp(self), list, &argc, &argv) == TCL_ERROR)
@ -1140,7 +1140,7 @@ Tkapp_Split(self, args)
{ {
char *list; char *list;
if (!PyArg_ParseTuple(args, "s", &list)) if (!PyArg_ParseTuple(args, "s:split", &list))
return NULL; return NULL;
return Split(list); return Split(list);
} }
@ -1261,7 +1261,7 @@ Tkapp_CreateCommand(self, args)
PyObject *func; PyObject *func;
Tcl_Command err; Tcl_Command err;
if (!PyArg_ParseTuple(args, "sO", &cmdName, &func)) if (!PyArg_ParseTuple(args, "sO:createcommand", &cmdName, &func))
return NULL; return NULL;
if (!PyCallable_Check(func)) { if (!PyCallable_Check(func)) {
PyErr_SetString(PyExc_TypeError, "command not callable"); PyErr_SetString(PyExc_TypeError, "command not callable");
@ -1300,7 +1300,7 @@ Tkapp_DeleteCommand(self, args)
char *cmdName; char *cmdName;
int err; int err;
if (!PyArg_ParseTuple(args, "s", &cmdName)) if (!PyArg_ParseTuple(args, "s:deletecommand", &cmdName))
return NULL; return NULL;
ENTER_TCL ENTER_TCL
err = Tcl_DeleteCommand(Tkapp_Interp(self), cmdName); err = Tcl_DeleteCommand(Tkapp_Interp(self), cmdName);
@ -1443,7 +1443,7 @@ Tkapp_CreateFileHandler(self, args)
int mask, id; int mask, id;
FHANDLE tfile; FHANDLE tfile;
if (!PyArg_ParseTuple(args, "OiO", &file, &mask, &func)) if (!PyArg_ParseTuple(args, "OiO:createfilehandler", &file, &mask, &func))
return NULL; return NULL;
id = GetFileNo(file); id = GetFileNo(file);
if (id < 0) if (id < 0)
@ -1476,7 +1476,7 @@ Tkapp_DeleteFileHandler(self, args)
int id; int id;
FHANDLE tfile; FHANDLE tfile;
if (!PyArg_ParseTuple(args, "O", &file)) if (!PyArg_ParseTuple(args, "O:deletefilehandler", &file))
return NULL; return NULL;
id = GetFileNo(file); id = GetFileNo(file);
if (id < 0) if (id < 0)
@ -1513,7 +1513,7 @@ Tktt_DeleteTimerHandler(self, args)
TkttObject *v = (TkttObject *)self; TkttObject *v = (TkttObject *)self;
PyObject *func = v->func; PyObject *func = v->func;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":deletetimerhandler"))
return NULL; return NULL;
if (v->token != NULL) { if (v->token != NULL) {
Tcl_DeleteTimerHandler(v->token); Tcl_DeleteTimerHandler(v->token);
@ -1646,7 +1646,7 @@ Tkapp_CreateTimerHandler(self, args)
PyObject *func; PyObject *func;
TkttObject *v; TkttObject *v;
if (!PyArg_ParseTuple(args, "iO", &milliseconds, &func)) if (!PyArg_ParseTuple(args, "iO:createtimerhandler", &milliseconds, &func))
return NULL; return NULL;
if (!PyCallable_Check(func)) { if (!PyCallable_Check(func)) {
PyErr_SetString(PyExc_TypeError, "bad argument list"); PyErr_SetString(PyExc_TypeError, "bad argument list");
@ -1672,7 +1672,7 @@ Tkapp_MainLoop(self, args)
PyThreadState *tstate = PyThreadState_Get(); PyThreadState *tstate = PyThreadState_Get();
#endif #endif
if (!PyArg_ParseTuple(args, "|i", &threshold)) if (!PyArg_ParseTuple(args, "|i:mainloop", &threshold))
return NULL; return NULL;
quitMainLoop = 0; quitMainLoop = 0;
@ -1721,7 +1721,7 @@ Tkapp_DoOneEvent(self, args)
int flags = 0; int flags = 0;
int rv; int rv;
if (!PyArg_ParseTuple(args, "|i", &flags)) if (!PyArg_ParseTuple(args, "|i:dooneevent", &flags))
return NULL; return NULL;
ENTER_TCL ENTER_TCL
@ -1736,7 +1736,7 @@ Tkapp_Quit(self, args)
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":quit"))
return NULL; return NULL;
quitMainLoop = 1; quitMainLoop = 1;
@ -1750,7 +1750,7 @@ Tkapp_InterpAddr(self, args)
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":interpaddr"))
return NULL; return NULL;
return PyInt_FromLong((long)Tkapp_Interp(self)); return PyInt_FromLong((long)Tkapp_Interp(self));
@ -1862,7 +1862,7 @@ Tkinter_Create(self, args)
baseName = Py_GetProgramName(); baseName = Py_GetProgramName();
className = "Tk"; className = "Tk";
if (!PyArg_ParseTuple(args, "|zssi", if (!PyArg_ParseTuple(args, "|zssi:create",
&screenName, &baseName, &className, &screenName, &baseName, &className,
&interactive)) &interactive))
return NULL; return NULL;

View File

@ -281,7 +281,7 @@ SetConfig(self, args, func)
{ {
int par; int par;
if (!PyArg_ParseTuple(args, "i", &par)) if (!PyArg_ParseTuple(args, "i:SetConfig", &par))
return NULL; return NULL;
if ((*func)(self->config, par) == -1) if ((*func)(self->config, par) == -1)
@ -299,7 +299,7 @@ GetConfig(self, args, func)
{ {
int par; int par;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetConfig"))
return NULL; return NULL;
if ((par = (*func)(self->config)) == -1) if ((par = (*func)(self->config)) == -1)
@ -397,7 +397,7 @@ alc_SetFloatMax(self, args)
{ {
double maximum_value; double maximum_value;
if (!PyArg_ParseTuple(args, "d", &maximum_value)) if (!PyArg_ParseTuple(args, "d:SetFloatMax", &maximum_value))
return NULL; return NULL;
if (alSetFloatMax(self->config, maximum_value) < 0) if (alSetFloatMax(self->config, maximum_value) < 0)
return NULL; return NULL;
@ -417,7 +417,7 @@ alc_GetFloatMax(self, args)
{ {
double maximum_value; double maximum_value;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFloatMax"))
return NULL; return NULL;
if ((maximum_value = alGetFloatMax(self->config)) == 0) if ((maximum_value = alGetFloatMax(self->config)) == 0)
return NULL; return NULL;
@ -486,7 +486,7 @@ setconfig(self, args, func)
{ {
long par; long par;
if (!PyArg_ParseTuple(args, "l", &par)) if (!PyArg_ParseTuple(args, "l:SetConfig", &par))
return NULL; return NULL;
if ((*func)(self->config, par) == -1) if ((*func)(self->config, par) == -1)
@ -504,7 +504,7 @@ getconfig(self, args, func)
{ {
long par; long par;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetConfig"))
return NULL; return NULL;
if ((par = (*func)(self->config)) == -1) if ((par = (*func)(self->config)) == -1)
@ -586,7 +586,7 @@ alc_getfloatmax(self, args)
{ {
double arg; double arg;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFloatMax"))
return 0; return 0;
if ((arg = ALgetfloatmax(self->config)) == 0) if ((arg = ALgetfloatmax(self->config)) == 0)
return NULL; return NULL;
@ -600,7 +600,7 @@ alc_setfloatmax(self, args)
{ {
double arg; double arg;
if (!PyArg_ParseTuple(args, "d", &arg)) if (!PyArg_ParseTuple(args, "d:SetFloatMax", &arg))
return 0; return 0;
if (ALsetfloatmax(self->config, arg) == -1) if (ALsetfloatmax(self->config, arg) == -1)
return NULL; return NULL;
@ -723,7 +723,7 @@ alp_SetConfig(self, args)
PyObject *args; PyObject *args;
{ {
alcobject *config; alcobject *config;
if (!PyArg_ParseTuple(args, "O!", &Alctype, &config)) if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config))
return NULL; return NULL;
if (alSetConfig(self->port, config->config) < 0) if (alSetConfig(self->port, config->config) < 0)
return NULL; return NULL;
@ -742,7 +742,7 @@ alp_GetConfig(self, args)
PyObject *args; PyObject *args;
{ {
ALconfig config; ALconfig config;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetConfig"))
return NULL; return NULL;
if ((config = alGetConfig(self->port)) == NULL) if ((config = alGetConfig(self->port)) == NULL)
return NULL; return NULL;
@ -761,7 +761,7 @@ alp_GetResource(self, args)
{ {
int resource; int resource;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetResource"))
return NULL; return NULL;
if ((resource = alGetResource(self->port)) == 0) if ((resource = alGetResource(self->port)) == 0)
return NULL; return NULL;
@ -780,7 +780,7 @@ alp_GetFD(self, args)
{ {
int fd; int fd;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFD"))
return NULL; return NULL;
if ((fd = alGetFD(self->port)) < 0) if ((fd = alGetFD(self->port)) < 0)
@ -801,7 +801,7 @@ alp_GetFilled(self, args)
{ {
int filled; int filled;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFilled"))
return NULL; return NULL;
if ((filled = alGetFilled(self->port)) < 0) if ((filled = alGetFilled(self->port)) < 0)
return NULL; return NULL;
@ -820,7 +820,7 @@ alp_GetFillable(self, args)
{ {
int fillable; int fillable;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFillable"))
return NULL; return NULL;
if ((fillable = alGetFillable(self->port)) < 0) if ((fillable = alGetFillable(self->port)) < 0)
return NULL; return NULL;
@ -844,7 +844,7 @@ alp_ReadFrames(self, args)
int ch; int ch;
ALconfig c; ALconfig c;
if (!PyArg_ParseTuple(args, "i", &framecount)) if (!PyArg_ParseTuple(args, "i:ReadFrames", &framecount))
return NULL; return NULL;
if (framecount < 0) { if (framecount < 0) {
PyErr_SetString(ErrorObject, "negative framecount"); PyErr_SetString(ErrorObject, "negative framecount");
@ -910,7 +910,7 @@ alp_DiscardFrames(self, args)
{ {
int framecount; int framecount;
if (!PyArg_ParseTuple(args, "i", &framecount)) if (!PyArg_ParseTuple(args, "i:DiscardFrames", &framecount))
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
@ -935,7 +935,7 @@ alp_ZeroFrames(self, args)
{ {
int framecount; int framecount;
if (!PyArg_ParseTuple(args, "i", &framecount)) if (!PyArg_ParseTuple(args, "i:ZeroFrames", &framecount))
return NULL; return NULL;
if (framecount < 0) { if (framecount < 0) {
@ -963,7 +963,7 @@ alp_SetFillPoint(self, args)
{ {
int fillpoint; int fillpoint;
if (!PyArg_ParseTuple(args, "i", &fillpoint)) if (!PyArg_ParseTuple(args, "i:SetFillPoint", &fillpoint))
return NULL; return NULL;
if (alSetFillPoint(self->port, fillpoint) < 0) if (alSetFillPoint(self->port, fillpoint) < 0)
@ -985,7 +985,7 @@ alp_GetFillPoint(self, args)
{ {
int fillpoint; int fillpoint;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFillPoint"))
return NULL; return NULL;
if ((fillpoint = alGetFillPoint(self->port)) < 0) if ((fillpoint = alGetFillPoint(self->port)) < 0)
@ -1006,7 +1006,7 @@ alp_GetFrameNumber(self, args)
{ {
stamp_t fnum; stamp_t fnum;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFrameNumber"))
return NULL; return NULL;
if (alGetFrameNumber(self->port, &fnum) < 0) if (alGetFrameNumber(self->port, &fnum) < 0)
@ -1028,7 +1028,7 @@ alp_GetFrameTime(self, args)
stamp_t fnum, time; stamp_t fnum, time;
PyObject *ret, *v0, *v1; PyObject *ret, *v0, *v1;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFrameTime"))
return NULL; return NULL;
if (alGetFrameTime(self->port, &fnum, &time) < 0) if (alGetFrameTime(self->port, &fnum, &time) < 0)
return NULL; return NULL;
@ -1060,7 +1060,7 @@ alp_WriteFrames(self, args)
int size, ch; int size, ch;
ALconfig c; ALconfig c;
if (!PyArg_ParseTuple(args, "s#", &samples, &length)) if (!PyArg_ParseTuple(args, "s#:WriteFrames", &samples, &length))
return NULL; return NULL;
c = alGetConfig(self->port); c = alGetConfig(self->port);
switch (alGetSampFmt(c)) { switch (alGetSampFmt(c)) {
@ -1123,7 +1123,7 @@ alp_ClosePort(self, args)
alpobject *self; alpobject *self;
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":ClosePort"))
return NULL; return NULL;
if (alClosePort(self->port) < 0) if (alClosePort(self->port) < 0)
return NULL; return NULL;
@ -1140,7 +1140,7 @@ alp_closeport(self, args)
alpobject *self; alpobject *self;
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":ClosePort"))
return NULL; return NULL;
if (ALcloseport(self->port) < 0) if (ALcloseport(self->port) < 0)
return NULL; return NULL;
@ -1156,7 +1156,7 @@ alp_getfd (self, args)
{ {
int fd; int fd;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFD"))
return NULL; return NULL;
if ((fd = ALgetfd(self-> port)) == -1) if ((fd = ALgetfd(self-> port)) == -1)
return NULL; return NULL;
@ -1170,7 +1170,7 @@ alp_getfilled(self, args)
{ {
long count; long count;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFilled"))
return NULL; return NULL;
if ((count = ALgetfilled(self-> port)) == -1) if ((count = ALgetfilled(self-> port)) == -1)
return NULL; return NULL;
@ -1184,7 +1184,7 @@ alp_getfillable(self, args)
{ {
long count; long count;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFillable"))
return NULL; return NULL;
if ((count = ALgetfillable(self-> port)) == -1) if ((count = ALgetfillable(self-> port)) == -1)
return NULL; return NULL;
@ -1202,7 +1202,7 @@ alp_readsamps(self, args)
int width; int width;
int ret; int ret;
if (!PyArg_ParseTuple(args, "l", &count)) if (!PyArg_ParseTuple(args, "l:readsamps", &count))
return NULL; return NULL;
if (count <= 0) { if (count <= 0) {
@ -1248,7 +1248,7 @@ alp_writesamps(self, args)
ALconfig c; ALconfig c;
int ret; int ret;
if (!PyArg_ParseTuple(args, "s#", &buf, &size)) if (!PyArg_ParseTuple(args, "s#:writesamps", &buf, &size))
return NULL; return NULL;
c = ALgetconfig(self->port); c = ALgetconfig(self->port);
@ -1281,7 +1281,7 @@ alp_getfillpoint(self, args)
{ {
long count; long count;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetFillPoint"))
return NULL; return NULL;
if ((count = ALgetfillpoint(self->port)) == -1) if ((count = ALgetfillpoint(self->port)) == -1)
return NULL; return NULL;
@ -1295,7 +1295,7 @@ alp_setfillpoint (self, args)
{ {
long count; long count;
if (!PyArg_ParseTuple(args, "l", &count)) if (!PyArg_ParseTuple(args, "l:SetFillPoint", &count))
return NULL; return NULL;
if (ALsetfillpoint(self->port, count) == -1) if (ALsetfillpoint(self->port, count) == -1)
return NULL; return NULL;
@ -1310,7 +1310,7 @@ alp_setconfig(self, args)
{ {
alcobject *config; alcobject *config;
if (!PyArg_ParseTuple(args, "O!", &Alctype, &config)) if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config))
return NULL; return NULL;
if (ALsetconfig(self->port, config->config) == -1) if (ALsetconfig(self->port, config->config) == -1)
return NULL; return NULL;
@ -1325,7 +1325,7 @@ alp_getconfig(self, args)
{ {
ALconfig config; ALconfig config;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":GetConfig"))
return NULL; return NULL;
config = ALgetconfig(self->port); config = ALgetconfig(self->port);
if (config == NULL) if (config == NULL)
@ -1504,7 +1504,7 @@ al_NewConfig(self, args)
{ {
ALconfig config; ALconfig config;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":NewConfig"))
return NULL; return NULL;
if ((config = alNewConfig()) == NULL) if ((config = alNewConfig()) == NULL)
return NULL; return NULL;
@ -1524,7 +1524,7 @@ al_OpenPort(self, args)
char *name, *dir; char *name, *dir;
alcobject *config = NULL; 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; return NULL;
if ((port = alOpenPort(name, dir, config ? config->config : NULL)) == NULL) if ((port = alOpenPort(name, dir, config ? config->config : NULL)) == NULL)
return NULL; return NULL;
@ -1545,7 +1545,7 @@ al_Connect(self, args)
ALparamInfo *propinfo = NULL; ALparamInfo *propinfo = NULL;
PyObject *propobj = 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; return NULL;
if (propobj != NULL) { if (propobj != NULL) {
nprops = python2params(source, dest, propobj, &props, &propinfo); nprops = python2params(source, dest, propobj, &props, &propinfo);
@ -1584,7 +1584,7 @@ al_Disconnect(self, args)
{ {
int res; int res;
if (!PyArg_ParseTuple(args, "i", &res)) if (!PyArg_ParseTuple(args, "i:Disconnect", &res))
return NULL; return NULL;
if (alDisconnect(res) < 0) if (alDisconnect(res) < 0)
return NULL; return NULL;
@ -1607,7 +1607,7 @@ al_GetParams(self, args)
int i, j, npvs; int i, j, npvs;
ALparamInfo *pinfo; ALparamInfo *pinfo;
if (!PyArg_ParseTuple(args, "iO!", &resource, &PyList_Type, &pvslist)) if (!PyArg_ParseTuple(args, "iO!:GetParams", &resource, &PyList_Type, &pvslist))
return NULL; return NULL;
npvs = PyList_Size(pvslist); npvs = PyList_Size(pvslist);
pvs = PyMem_NEW(ALpv, npvs); pvs = PyMem_NEW(ALpv, npvs);
@ -1753,7 +1753,7 @@ al_SetParams(self, args)
ALparamInfo *pinfo; ALparamInfo *pinfo;
int npvs, i; int npvs, i;
if (!PyArg_ParseTuple(args, "iO!", &resource, &PyList_Type, &pvslist)) if (!PyArg_ParseTuple(args, "iO!:SetParams", &resource, &PyList_Type, &pvslist))
return NULL; return NULL;
npvs = python2params(resource, -1, pvslist, &pvs, &pinfo); npvs = python2params(resource, -1, pvslist, &pvs, &pinfo);
if (npvs < 0) if (npvs < 0)
@ -1804,7 +1804,7 @@ al_QueryValues(self, args)
PyObject *qualobj = NULL; PyObject *qualobj = NULL;
PyObject *res = NULL, *item; PyObject *res = NULL, *item;
if (!PyArg_ParseTuple(args, "ii|O!", &resource, &param, if (!PyArg_ParseTuple(args, "ii|O!:QueryValues", &resource, &param,
&PyList_Type, &qualobj)) &PyList_Type, &qualobj))
return NULL; return NULL;
if (qualobj != NULL) { if (qualobj != NULL) {
@ -1881,7 +1881,7 @@ al_GetParamInfo(self, args)
ALparamInfo pinfo; ALparamInfo pinfo;
PyObject *v, *item;; PyObject *v, *item;;
if (!PyArg_ParseTuple(args, "ii", &res, &param)) if (!PyArg_ParseTuple(args, "ii:GetParamInfo", &res, &param))
return NULL; return NULL;
if (alGetParamInfo(res, param, &pinfo) < 0) if (alGetParamInfo(res, param, &pinfo) < 0)
return NULL; return NULL;
@ -1965,7 +1965,7 @@ al_GetResourceByName(self, args)
int res, start_res, type; int res, start_res, type;
char *name; char *name;
if (!PyArg_ParseTuple(args, "isi", &start_res, &name, &type)) if (!PyArg_ParseTuple(args, "isi:GetResourceByName", &start_res, &name, &type))
return NULL; return NULL;
if ((res = alGetResourceByName(start_res, name, type)) == 0) if ((res = alGetResourceByName(start_res, name, type)) == 0)
return NULL; return NULL;
@ -1983,7 +1983,7 @@ al_IsSubtype(self, args)
{ {
int type, subtype; int type, subtype;
if (!PyArg_ParseTuple(args, "ii", &type, &subtype)) if (!PyArg_ParseTuple(args, "ii:IsSubtype", &type, &subtype))
return NULL; return NULL;
return PyInt_FromLong((long) alIsSubtype(type, subtype)); return PyInt_FromLong((long) alIsSubtype(type, subtype));
} }
@ -1998,7 +1998,7 @@ al_SetErrorHandler(self, args)
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":SetErrorHandler"))
return NULL; return NULL;
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
@ -2016,7 +2016,7 @@ al_openport(self, args)
ALport port; ALport port;
alcobject *config = NULL; 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; return NULL;
if ((port = ALopenport(name, dir, config ? config->config : NULL)) == NULL) if ((port = ALopenport(name, dir, config ? config->config : NULL)) == NULL)
return NULL; return NULL;
@ -2029,7 +2029,7 @@ al_newconfig(self, args)
{ {
ALconfig config; ALconfig config;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":NewConfig"))
return NULL; return NULL;
if ((config = ALnewconfig ()) == NULL) if ((config = ALnewconfig ()) == NULL)
return NULL; return NULL;
@ -2047,7 +2047,7 @@ al_queryparams(self, args)
PyObject *v = NULL; PyObject *v = NULL;
int i; int i;
if (!PyArg_ParseTuple(args, "l", &device)) if (!PyArg_ParseTuple(args, "l:queryparams", &device))
return NULL; return NULL;
if ((length = ALqueryparams(device, PVdummy, 2L)) == -1) if ((length = ALqueryparams(device, PVdummy, 2L)) == -1)
return NULL; return NULL;
@ -2127,7 +2127,7 @@ al_getname(self, args)
long device, descriptor; long device, descriptor;
char *name; char *name;
if (!PyArg_ParseTuple(args, "ll", &device, &descriptor)) if (!PyArg_ParseTuple(args, "ll:getname", &device, &descriptor))
return NULL; return NULL;
if ((name = ALgetname(device, descriptor)) == NULL) if ((name = ALgetname(device, descriptor)) == NULL)
return NULL; return NULL;
@ -2140,7 +2140,7 @@ al_getdefault(self, args)
{ {
long device, descriptor, value; long device, descriptor, value;
if (!PyArg_ParseTuple(args, "ll", &device, &descriptor)) if (!PyArg_ParseTuple(args, "ll:getdefault", &device, &descriptor))
return NULL; return NULL;
if ((value = ALgetdefault(device, descriptor)) == -1) if ((value = ALgetdefault(device, descriptor)) == -1)
return NULL; return NULL;
@ -2153,7 +2153,7 @@ al_getminmax(self, args)
{ {
long device, descriptor, min, max; long device, descriptor, min, max;
if (!PyArg_ParseTuple(args, "ll", &device, &descriptor)) if (!PyArg_ParseTuple(args, "ll:getminmax", &device, &descriptor))
return NULL; return NULL;
min = -1; min = -1;
max = -1; max = -1;

View File

@ -981,7 +981,7 @@ audioop_ratecv(self, args)
weightA = 1; weightA = 1;
weightB = 0; 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)) &inrate, &outrate, &state, &weightA, &weightB))
return NULL; return NULL;
if (size != 1 && size != 2 && size != 4) { if (size != 1 && size != 2 && size != 4) {
@ -1034,7 +1034,7 @@ audioop_ratecv(self, args)
} }
for (chan = 0; chan < nchannels; chan++) { for (chan = 0; chan < nchannels; chan++) {
if (!PyArg_ParseTuple(PyTuple_GetItem(samps, 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; goto exit;
} }
} }

View File

@ -213,7 +213,7 @@ binascii_a2b_uu(self, args)
PyObject *rv; PyObject *rv;
int ascii_len, bin_len; 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; return NULL;
/* First byte: binary data length (in bytes) */ /* First byte: binary data length (in bytes) */
@ -290,7 +290,7 @@ binascii_b2a_uu(self, args)
PyObject *rv; PyObject *rv;
int bin_len; 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; return NULL;
if ( bin_len > 45 ) { if ( bin_len > 45 ) {
/* The 45 is a limit that appears in all uuencode's */ /* 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 ascii_len, bin_len;
int quad_pos = 0; 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; return NULL;
bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */ bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */
@ -456,7 +456,7 @@ binascii_b2a_base64(self, args)
PyObject *rv; PyObject *rv;
int bin_len; 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; return NULL;
if ( bin_len > BASE64_MAXBIN ) { if ( bin_len > BASE64_MAXBIN ) {
PyErr_SetString(Error, "Too much data for base64 line"); PyErr_SetString(Error, "Too much data for base64 line");
@ -510,7 +510,7 @@ binascii_a2b_hqx(self, args)
int len; int len;
int done = 0; int done = 0;
if ( !PyArg_ParseTuple(args, "t#", &ascii_data, &len) ) if ( !PyArg_ParseTuple(args, "t#:a2b_hqx", &ascii_data, &len) )
return NULL; return NULL;
/* Allocate a string that is too big (fixed later) */ /* Allocate a string that is too big (fixed later) */
@ -573,7 +573,7 @@ PyObject *args;
unsigned char ch; unsigned char ch;
int in, inend, len; int in, inend, len;
if ( !PyArg_ParseTuple(args, "s#", &in_data, &len) ) if ( !PyArg_ParseTuple(args, "s#:rlecode_hqx", &in_data, &len) )
return NULL; return NULL;
/* Worst case: output is twice as big as input (fixed later) */ /* Worst case: output is twice as big as input (fixed later) */
@ -624,7 +624,7 @@ binascii_b2a_hqx(self, args)
PyObject *rv; PyObject *rv;
int len; int len;
if ( !PyArg_ParseTuple(args, "s#", &bin_data, &len) ) if ( !PyArg_ParseTuple(args, "s#:b2a_hqx", &bin_data, &len) )
return NULL; return NULL;
/* Allocate a buffer that is at least large enough */ /* Allocate a buffer that is at least large enough */
@ -664,7 +664,7 @@ binascii_rledecode_hqx(self, args)
PyObject *rv; PyObject *rv;
int in_len, out_len, out_len_left; 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; return NULL;
/* Empty string is a special case */ /* Empty string is a special case */
@ -762,7 +762,7 @@ PyObject *args;
unsigned int crc; unsigned int crc;
int len; 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; return NULL;
while(len--) { while(len--) {
@ -902,7 +902,7 @@ binascii_crc32(self, args)
unsigned long crc = 0UL; /* initial value of CRC */ unsigned long crc = 0UL; /* initial value of CRC */
int len; 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; return NULL;
crc = crc ^ 0xFFFFFFFFUL; crc = crc ^ 0xFFFFFFFFUL;

View File

@ -697,7 +697,7 @@ bsdhashopen(self, args)
int hash = 0; /* XXX currently ignored */ int hash = 0; /* XXX currently ignored */
int lorder = 0; int lorder = 0;
if (!PyArg_ParseTuple(args, "s|siiiiiii", if (!PyArg_ParseTuple(args, "s|siiiiiii:hashopen",
&file, &flag, &mode, &file, &flag, &mode,
&bsize, &ffactor, &nelem, &cachesize, &bsize, &ffactor, &nelem, &cachesize,
&hash, &lorder)) &hash, &lorder))
@ -750,7 +750,7 @@ bsdbtopen(self, args)
unsigned int psize = 0; unsigned int psize = 0;
int lorder = 0; int lorder = 0;
if (!PyArg_ParseTuple(args, "s|siiiiiii", if (!PyArg_ParseTuple(args, "s|siiiiiii:btopen",
&file, &flag, &mode, &file, &flag, &mode,
&btflags, &cachesize, &maxkeypage, &minkeypage, &btflags, &cachesize, &maxkeypage, &minkeypage,
&psize, &lorder)) &psize, &lorder))
@ -805,7 +805,7 @@ bsdrnopen(self, args)
char *bval = ""; char *bval = "";
char *bfname = NULL; char *bfname = NULL;
if (!PyArg_ParseTuple(args, "s|siiiiiiss", if (!PyArg_ParseTuple(args, "s|siiiiiiss:rnopen",
&file, &flag, &mode, &file, &flag, &mode,
&rnflags, &cachesize, &psize, &lorder, &rnflags, &cachesize, &psize, &lorder,
&reclen, &bval, &bfname)) &reclen, &bval, &bfname))

View File

@ -1868,7 +1868,7 @@ dump(Picklerobject *self, PyObject *args) {
static PyObject * static PyObject *
Pickle_clear_memo(Picklerobject *self, PyObject *args) { 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); if (self->memo) PyDict_Clear(self->memo);
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
@ -1882,7 +1882,7 @@ Pickle_getvalue(Picklerobject *self, PyObject *args) {
char *s, *p, *have_get; char *s, *p, *have_get;
Pdata *data; 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 */ /* Check to make sure we are based on a list */
if (! Pdata_Check(self->file)) { if (! Pdata_Check(self->file)) {
@ -2014,7 +2014,7 @@ Pickler_dump(Picklerobject *self, PyObject *args) {
PyObject *ob; PyObject *ob;
int get=0; int get=0;
UNLESS (PyArg_ParseTuple(args, "O|i", &ob, &get)) UNLESS (PyArg_ParseTuple(args, "O|i:dump", &ob, &get))
return NULL; return NULL;
if (dump(self, ob) < 0) if (dump(self, ob) < 0)
@ -2132,10 +2132,10 @@ get_Pickler(PyObject *self, PyObject *args) {
int bin; int bin;
bin=1; bin=1;
if (! PyArg_ParseTuple(args, "|i", &bin)) { if (! PyArg_ParseTuple(args, "|i:Pickler", &bin)) {
PyErr_Clear(); PyErr_Clear();
bin=0; bin=0;
if (! PyArg_ParseTuple(args, "O|i", &file, &bin)) if (! PyArg_ParseTuple(args, "O|i:Pickler", &file, &bin))
return NULL; return NULL;
} }
return (PyObject *)newPicklerobject(file, bin); return (PyObject *)newPicklerobject(file, bin);
@ -3853,7 +3853,7 @@ noload(Unpicklerobject *self) {
static PyObject * static PyObject *
Unpickler_load(Unpicklerobject *self, PyObject *args) { Unpickler_load(Unpicklerobject *self, PyObject *args) {
UNLESS (PyArg_ParseTuple(args, "")) UNLESS (PyArg_ParseTuple(args, ":load"))
return NULL; return NULL;
return load(self); return load(self);
@ -3861,7 +3861,7 @@ Unpickler_load(Unpicklerobject *self, PyObject *args) {
static PyObject * static PyObject *
Unpickler_noload(Unpicklerobject *self, PyObject *args) { Unpickler_noload(Unpicklerobject *self, PyObject *args) {
UNLESS (PyArg_ParseTuple(args, "")) UNLESS (PyArg_ParseTuple(args, ":noload"))
return NULL; return NULL;
return noload(self); return noload(self);
@ -3969,7 +3969,7 @@ static PyObject *
get_Unpickler(PyObject *self, PyObject *args) { get_Unpickler(PyObject *self, PyObject *args) {
PyObject *file; PyObject *file;
UNLESS (PyArg_ParseTuple(args, "O", &file)) UNLESS (PyArg_ParseTuple(args, "O:Unpickler", &file))
return NULL; return NULL;
return (PyObject *)newUnpicklerobject(file); return (PyObject *)newUnpicklerobject(file);
} }
@ -4110,7 +4110,7 @@ cpm_dumps(PyObject *self, PyObject *args) {
Picklerobject *pickler = 0; Picklerobject *pickler = 0;
int bin = 0; int bin = 0;
UNLESS (PyArg_ParseTuple(args, "O|i", &ob, &bin)) UNLESS (PyArg_ParseTuple(args, "O|i:dumps", &ob, &bin))
goto finally; goto finally;
UNLESS (file = PycStringIO->NewOutput(128)) UNLESS (file = PycStringIO->NewOutput(128))
@ -4137,7 +4137,7 @@ cpm_load(PyObject *self, PyObject *args) {
Unpicklerobject *unpickler = 0; Unpicklerobject *unpickler = 0;
PyObject *ob, *res = NULL; PyObject *ob, *res = NULL;
UNLESS (PyArg_ParseTuple(args, "O", &ob)) UNLESS (PyArg_ParseTuple(args, "O:load", &ob))
goto finally; goto finally;
UNLESS (unpickler = newUnpicklerobject(ob)) UNLESS (unpickler = newUnpicklerobject(ob))
@ -4157,7 +4157,7 @@ cpm_loads(PyObject *self, PyObject *args) {
PyObject *ob, *file = 0, *res = NULL; PyObject *ob, *file = 0, *res = NULL;
Unpicklerobject *unpickler = 0; Unpicklerobject *unpickler = 0;
UNLESS (PyArg_ParseTuple(args, "S", &ob)) UNLESS (PyArg_ParseTuple(args, "S:loads", &ob))
goto finally; goto finally;
UNLESS (file = PycStringIO->NewInput(ob)) UNLESS (file = PycStringIO->NewInput(ob))

View File

@ -134,7 +134,7 @@ static PyObject *
O_seek(Oobject *self, PyObject *args) { O_seek(Oobject *self, PyObject *args) {
int position, mode = 0; int position, mode = 0;
UNLESS(PyArg_ParseTuple(args, "i|i", &position, &mode)) { UNLESS(PyArg_ParseTuple(args, "i|i:seek", &position, &mode)) {
return NULL; return NULL;
} }
@ -187,7 +187,7 @@ O_read(Oobject *self, PyObject *args) {
int n = -1; int n = -1;
char *output; 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); n=O_cread((PyObject*)self,&output,n);
@ -264,7 +264,7 @@ O_write(Oobject *self, PyObject *args) {
char *c; char *c;
int l; 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(-1 != (l=PyString_Size(s))) return NULL;
UNLESS(c=PyString_AsString(s)) return NULL; UNLESS(c=PyString_AsString(s)) return NULL;
UNLESS(-1 != O_cwrite((PyObject*)self,c,l)) return NULL; UNLESS(-1 != O_cwrite((PyObject*)self,c,l)) return NULL;
@ -286,7 +286,7 @@ O_getval(Oobject *self, PyObject *args) {
int s; int s;
use_pos=Py_None; 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)) { if(PyObject_IsTrue(use_pos)) {
s=self->pos; s=self->pos;
if (s > self->string_size) s=self->string_size; if (s > self->string_size) s=self->string_size;
@ -350,7 +350,7 @@ O_writelines(Oobject *self, PyObject *args) {
PyObject *string_module = 0; PyObject *string_module = 0;
static PyObject *string_joinfields = 0; static PyObject *string_joinfields = 0;
UNLESS(PyArg_ParseTuple(args, "O", &args)) { UNLESS(PyArg_ParseTuple(args, "O:writelines", &args)) {
return NULL; return NULL;
} }
@ -500,7 +500,7 @@ static PyObject *
I_seek(Oobject *self, PyObject *args) { I_seek(Oobject *self, PyObject *args) {
int position, mode = 0; int position, mode = 0;
UNLESS(PyArg_ParseTuple(args, "i|i", &position, &mode)) { UNLESS(PyArg_ParseTuple(args, "i|i:seek", &position, &mode)) {
return NULL; return NULL;
} }
@ -603,7 +603,7 @@ static PyObject *
IO_StringIO(PyObject *self, PyObject *args) { IO_StringIO(PyObject *self, PyObject *args) {
PyObject *s=0; 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); if(s) return newIobject(s);
return newOobject(128); return newOobject(128);
} }

View File

@ -50,7 +50,7 @@ CD_allowremoval(self, args)
cdplayerobject *self; cdplayerobject *self;
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":allowremoval"))
return NULL; return NULL;
CDallowremoval(self->ob_cdplayer); CDallowremoval(self->ob_cdplayer);
@ -64,7 +64,7 @@ CD_preventremoval(self, args)
cdplayerobject *self; cdplayerobject *self;
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":preventremoval"))
return NULL; return NULL;
CDpreventremoval(self->ob_cdplayer); CDpreventremoval(self->ob_cdplayer);
@ -78,7 +78,7 @@ CD_bestreadsize(self, args)
cdplayerobject *self; cdplayerobject *self;
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":bestreadsize"))
return NULL; return NULL;
return PyInt_FromLong((long) CDbestreadsize(self->ob_cdplayer)); return PyInt_FromLong((long) CDbestreadsize(self->ob_cdplayer));
@ -89,7 +89,7 @@ CD_close(self, args)
cdplayerobject *self; cdplayerobject *self;
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":close"))
return NULL; return NULL;
if (!CDclose(self->ob_cdplayer)) { if (!CDclose(self->ob_cdplayer)) {
@ -109,7 +109,7 @@ CD_eject(self, args)
{ {
CDSTATUS status; CDSTATUS status;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":eject"))
return NULL; return NULL;
if (!CDeject(self->ob_cdplayer)) { if (!CDeject(self->ob_cdplayer)) {
@ -132,7 +132,7 @@ CD_getstatus(self, args)
{ {
CDSTATUS status; CDSTATUS status;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":getstatus"))
return NULL; return NULL;
if (!CDgetstatus(self->ob_cdplayer, &status)) { if (!CDgetstatus(self->ob_cdplayer, &status)) {
@ -157,7 +157,7 @@ CD_gettrackinfo(self, args)
CDTRACKINFO info; CDTRACKINFO info;
CDSTATUS status; CDSTATUS status;
if (!PyArg_ParseTuple(args, "i", &track)) if (!PyArg_ParseTuple(args, "i:gettrackinfo", &track))
return NULL; return NULL;
if (!CDgettrackinfo(self->ob_cdplayer, track, &info)) { if (!CDgettrackinfo(self->ob_cdplayer, track, &info)) {
@ -181,7 +181,7 @@ CD_msftoblock(self, args)
{ {
int min, sec, frame; int min, sec, frame;
if (!PyArg_ParseTuple(args, "iii", &min, &sec, &frame)) if (!PyArg_ParseTuple(args, "iii:msftoblock", &min, &sec, &frame))
return NULL; return NULL;
return PyInt_FromLong((long) CDmsftoblock(self->ob_cdplayer, return PyInt_FromLong((long) CDmsftoblock(self->ob_cdplayer,
@ -196,7 +196,7 @@ CD_play(self, args)
int start, play; int start, play;
CDSTATUS status; CDSTATUS status;
if (!PyArg_ParseTuple(args, "ii", &start, &play)) if (!PyArg_ParseTuple(args, "ii:play", &start, &play))
return NULL; return NULL;
if (!CDplay(self->ob_cdplayer, start, play)) { if (!CDplay(self->ob_cdplayer, start, play)) {
@ -220,7 +220,7 @@ CD_playabs(self, args)
int min, sec, frame, play; int min, sec, frame, play;
CDSTATUS status; CDSTATUS status;
if (!PyArg_ParseTuple(args, "iiii", &min, &sec, &frame, &play)) if (!PyArg_ParseTuple(args, "iiii:playabs", &min, &sec, &frame, &play))
return NULL; return NULL;
if (!CDplayabs(self->ob_cdplayer, min, sec, frame, play)) { if (!CDplayabs(self->ob_cdplayer, min, sec, frame, play)) {
@ -244,7 +244,7 @@ CD_playtrack(self, args)
int start, play; int start, play;
CDSTATUS status; CDSTATUS status;
if (!PyArg_ParseTuple(args, "ii", &start, &play)) if (!PyArg_ParseTuple(args, "ii:playtrack", &start, &play))
return NULL; return NULL;
if (!CDplaytrack(self->ob_cdplayer, start, play)) { if (!CDplaytrack(self->ob_cdplayer, start, play)) {
@ -268,7 +268,7 @@ CD_playtrackabs(self, args)
int track, min, sec, frame, play; int track, min, sec, frame, play;
CDSTATUS status; CDSTATUS status;
if (!PyArg_ParseTuple(args, "iiiii", &track, &min, &sec, if (!PyArg_ParseTuple(args, "iiiii:playtrackabs", &track, &min, &sec,
&frame, &play)) &frame, &play))
return NULL; return NULL;
@ -293,7 +293,7 @@ CD_readda(self, args)
int numframes, n; int numframes, n;
PyObject *result; PyObject *result;
if (!PyArg_ParseTuple(args, "i", &numframes)) if (!PyArg_ParseTuple(args, "i:readda", &numframes))
return NULL; return NULL;
result = PyString_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); result = PyString_FromStringAndSize(NULL, numframes * sizeof(CDFRAME));
@ -322,7 +322,7 @@ CD_seek(self, args)
int min, sec, frame; int min, sec, frame;
long PyTryBlock; long PyTryBlock;
if (!PyArg_ParseTuple(args, "iii", &min, &sec, &frame)) if (!PyArg_ParseTuple(args, "iii:seek", &min, &sec, &frame))
return NULL; return NULL;
PyTryBlock = CDseek(self->ob_cdplayer, min, sec, frame); PyTryBlock = CDseek(self->ob_cdplayer, min, sec, frame);
@ -342,7 +342,7 @@ CD_seektrack(self, args)
int track; int track;
long PyTryBlock; long PyTryBlock;
if (!PyArg_ParseTuple(args, "i", &track)) if (!PyArg_ParseTuple(args, "i:seektrack", &track))
return NULL; return NULL;
PyTryBlock = CDseektrack(self->ob_cdplayer, track); PyTryBlock = CDseektrack(self->ob_cdplayer, track);
@ -361,7 +361,7 @@ CD_seekblock(self, args)
{ {
unsigned long PyTryBlock; unsigned long PyTryBlock;
if (!PyArg_ParseTuple(args, "l", &PyTryBlock)) if (!PyArg_ParseTuple(args, "l:seekblock", &PyTryBlock))
return NULL; return NULL;
PyTryBlock = CDseekblock(self->ob_cdplayer, PyTryBlock); PyTryBlock = CDseekblock(self->ob_cdplayer, PyTryBlock);
@ -380,7 +380,7 @@ CD_stop(self, args)
{ {
CDSTATUS status; CDSTATUS status;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":stop"))
return NULL; return NULL;
if (!CDstop(self->ob_cdplayer)) { if (!CDstop(self->ob_cdplayer)) {
@ -403,7 +403,7 @@ CD_togglepause(self, args)
{ {
CDSTATUS status; CDSTATUS status;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":togglepause"))
return NULL; return NULL;
if (!CDtogglepause(self->ob_cdplayer)) { if (!CDtogglepause(self->ob_cdplayer)) {
@ -503,7 +503,7 @@ CD_open(self, args)
*/ */
dev = NULL; dev = NULL;
direction = "r"; direction = "r";
if (!PyArg_ParseTuple(args, "|zs", &dev, &direction)) if (!PyArg_ParseTuple(args, "|zs:open", &dev, &direction))
return NULL; return NULL;
cdp = CDopen(dev, direction); cdp = CDopen(dev, direction);
@ -605,7 +605,7 @@ CD_deleteparser(self, args)
{ {
int i; int i;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":deleteparser"))
return NULL; return NULL;
CDdeleteparser(self->ob_cdparser); CDdeleteparser(self->ob_cdparser);
@ -632,7 +632,7 @@ CD_parseframe(self, args)
int length; int length;
CDFRAME *p; CDFRAME *p;
if (!PyArg_ParseTuple(args, "s#", &cdfp, &length)) if (!PyArg_ParseTuple(args, "s#:parseframe", &cdfp, &length))
return NULL; return NULL;
if (length % sizeof(CDFRAME) != 0) { if (length % sizeof(CDFRAME) != 0) {
@ -660,7 +660,7 @@ CD_removecallback(self, args)
{ {
int type; int type;
if (!PyArg_ParseTuple(args, "i", &type)) if (!PyArg_ParseTuple(args, "i:removecallback", &type))
return NULL; return NULL;
if (type < 0 || type >= NCALLBACKS) { if (type < 0 || type >= NCALLBACKS) {
@ -685,7 +685,7 @@ CD_resetparser(self, args)
cdparserobject *self; cdparserobject *self;
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":resetparser"))
return NULL; return NULL;
CDresetparser(self->ob_cdparser); CDresetparser(self->ob_cdparser);
@ -703,7 +703,7 @@ CD_addcallback(self, args)
PyObject *func, *funcarg; PyObject *func, *funcarg;
/* XXX - more work here */ /* XXX - more work here */
if (!PyArg_ParseTuple(args, "iOO", &type, &func, &funcarg)) if (!PyArg_ParseTuple(args, "iOO:addcallback", &type, &func, &funcarg))
return NULL; return NULL;
if (type < 0 || type >= NCALLBACKS) { if (type < 0 || type >= NCALLBACKS) {
@ -816,7 +816,7 @@ CD_createparser(self, args)
{ {
CDPARSER *cdp; CDPARSER *cdp;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":createparser"))
return NULL; return NULL;
cdp = CDcreateparser(); cdp = CDcreateparser();
if (cdp == NULL) { if (cdp == NULL) {
@ -833,7 +833,7 @@ CD_msftoframe(self, args)
{ {
int min, sec, frame; int min, sec, frame;
if (!PyArg_ParseTuple(args, "iii", &min, &sec, &frame)) if (!PyArg_ParseTuple(args, "iii:msftoframe", &min, &sec, &frame))
return NULL; return NULL;
return PyInt_FromLong((long) CDmsftoframe(min, sec, frame)); return PyInt_FromLong((long) CDmsftoframe(min, sec, frame));

View File

@ -286,7 +286,7 @@ PyObject *args;
int iflags; int iflags;
int mode = 0666; int mode = 0666;
if ( !PyArg_ParseTuple(args, "s|si", &name, &flags, &mode) ) if ( !PyArg_ParseTuple(args, "s|si:open", &name, &flags, &mode) )
return NULL; return NULL;
if ( strcmp(flags, "r") == 0 ) if ( strcmp(flags, "r") == 0 )
iflags = O_RDONLY; iflags = O_RDONLY;

View File

@ -234,7 +234,7 @@ fcntl_lockf(self, args)
int fd, code, ret, whence = 0; int fd, code, ret, whence = 0;
PyObject *lenobj = NULL, *startobj = NULL; 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)) &lenobj, &startobj, &whence))
return NULL; return NULL;

View File

@ -490,7 +490,7 @@ PyObject *args;
int iflags; int iflags;
int mode = 0666; int mode = 0666;
if ( !PyArg_ParseTuple(args, "s|si", &name, &flags, &mode) ) if ( !PyArg_ParseTuple(args, "s|si:open", &name, &flags, &mode) )
return NULL; return NULL;
switch (flags[0]) { switch (flags[0]) {
case 'r': case 'r':

View File

@ -237,7 +237,7 @@ MD5_new(self, args)
unsigned char *cp = NULL; unsigned char *cp = NULL;
int len = 0; int len = 0;
if (!PyArg_ParseTuple(args, "|s#", &cp, &len)) if (!PyArg_ParseTuple(args, "|s#:new", &cp, &len))
return NULL; return NULL;
if ((md5p = newmd5object()) == NULL) if ((md5p = newmd5object()) == NULL)

View File

@ -45,7 +45,7 @@ new_instance(unused, args)
PyObject* klass; PyObject* klass;
PyObject *dict; PyObject *dict;
PyInstanceObject *inst; PyInstanceObject *inst;
if (!PyArg_ParseTuple(args, "O!O!", if (!PyArg_ParseTuple(args, "O!O!:instance",
&PyClass_Type, &klass, &PyClass_Type, &klass,
&PyDict_Type, &dict)) &PyDict_Type, &dict))
return NULL; return NULL;
@ -71,7 +71,7 @@ new_instancemethod(unused, args)
PyObject* self; PyObject* self;
PyObject* classObj; PyObject* classObj;
if (!PyArg_ParseTuple(args, "OOO!", if (!PyArg_ParseTuple(args, "OOO!:instancemethod",
&func, &func,
&self, &self,
&PyClass_Type, &classObj)) &PyClass_Type, &classObj))
@ -105,7 +105,7 @@ new_function(unused, args)
PyObject* defaults = Py_None; PyObject* defaults = Py_None;
PyFunctionObject* newfunc; PyFunctionObject* newfunc;
if (!PyArg_ParseTuple(args, "O!O!|SO!", if (!PyArg_ParseTuple(args, "O!O!|SO!:function",
&PyCode_Type, &code, &PyCode_Type, &code,
&PyDict_Type, &globals, &PyDict_Type, &globals,
&name, &name,
@ -152,7 +152,7 @@ new_code(unused, args)
PyObject* lnotab; PyObject* lnotab;
PyBufferProcs *pb; PyBufferProcs *pb;
if (!PyArg_ParseTuple(args, "iiiiOO!O!O!SSiS", if (!PyArg_ParseTuple(args, "iiiiOO!O!O!SSiS:code",
&argcount, &nlocals, &stacksize, &flags, &argcount, &nlocals, &stacksize, &flags,
&code, &code,
&PyTuple_Type, &consts, &PyTuple_Type, &consts,
@ -188,7 +188,7 @@ new_module(unused, args)
{ {
char *name; char *name;
if (!PyArg_ParseTuple(args, "s", &name)) if (!PyArg_ParseTuple(args, "s:module", &name))
return NULL; return NULL;
return PyModule_New(name); return PyModule_New(name);
} }
@ -205,7 +205,7 @@ new_class(unused, args)
PyObject * classes; PyObject * classes;
PyObject * dict; 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)) &PyDict_Type, &dict))
return NULL; return NULL;
return PyClass_New(classes, dict, name); return PyClass_New(classes, dict, name);

View File

@ -109,7 +109,7 @@ PyPcre_exec(self, args)
int offsets[100*2]; int offsets[100*2];
PyObject *list; 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; return NULL;
if (endpos == -1) {endpos = stringlen;} if (endpos == -1) {endpos = stringlen;}
count = pcre_exec(self->regex, self->regex_extra, count = pcre_exec(self->regex, self->regex_extra,
@ -193,7 +193,7 @@ PyPcre_compile(self, args)
const char *error; const char *error;
int options, erroroffset; int options, erroroffset;
if (!PyArg_ParseTuple(args, "siO!", &pattern, &options, if (!PyArg_ParseTuple(args, "siO!:pcre_compile", &pattern, &options,
&PyDict_Type, &dictionary)) &PyDict_Type, &dictionary))
return NULL; return NULL;
rv = newPcreObject(args); rv = newPcreObject(args);
@ -471,7 +471,7 @@ PyPcre_expand(self, args)
unsigned char *repl; unsigned char *repl;
int size, total_len, i, start, pos; 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; return NULL;
repl=(unsigned char *)PyString_AsString(repl_obj); repl=(unsigned char *)PyString_AsString(repl_obj);

View File

@ -321,7 +321,7 @@ pure_purify_set_pool_id(self, args)
long memrep; long memrep;
int id; int id;
if (!PyArg_ParseTuple(args, "li", &memrep, &id)) if (!PyArg_ParseTuple(args, "li:purify_set_pool_id", &memrep, &id))
return NULL; return NULL;
purify_set_pool_id((char*)memrep, id); purify_set_pool_id((char*)memrep, id);
@ -343,7 +343,7 @@ pure_purify_set_user_data(self, args)
long memrep; long memrep;
long datarep; long datarep;
if (!PyArg_ParseTuple(args, "ll", &memrep, &datarep)) if (!PyArg_ParseTuple(args, "ll:purify_set_user_data", &memrep, &datarep))
return NULL; return NULL;
purify_set_user_data((char*)memrep, (void*)datarep); purify_set_user_data((char*)memrep, (void*)datarep);
@ -361,7 +361,7 @@ pure_purify_get_user_data(self, args)
long memrep; long memrep;
void* data; void* data;
if (!PyArg_ParseTuple(args, "l", &memrep)) if (!PyArg_ParseTuple(args, "l:purify_get_user_data", &memrep))
return NULL; return NULL;
data = purify_get_user_data((char*)memrep); data = purify_get_user_data((char*)memrep);
@ -411,7 +411,7 @@ pure_purify_map_pool(self, args)
PyObject* arg_callable; PyObject* arg_callable;
int id; int id;
if (!PyArg_ParseTuple(args, "iO", &id, &arg_callable)) if (!PyArg_ParseTuple(args, "iO:purify_map_pool", &id, &arg_callable))
return NULL; return NULL;
if (!PyCallable_Check(arg_callable)) { if (!PyCallable_Check(arg_callable)) {
@ -451,7 +451,7 @@ pure_purify_map_pool_id(self, args)
PyObject* saved_callable = MapCallable; PyObject* saved_callable = MapCallable;
PyObject* arg_callable; PyObject* arg_callable;
if (!PyArg_ParseTuple(args, "O", &arg_callable)) if (!PyArg_ParseTuple(args, "O:purify_map_pool_id", &arg_callable))
return NULL; return NULL;
if (!PyCallable_Check(arg_callable)) { if (!PyCallable_Check(arg_callable)) {
@ -530,7 +530,7 @@ pure_purify_name_thread(self, args)
int status; int status;
char* stringarg; char* stringarg;
if (!PyArg_ParseTuple(args, "s", &stringarg)) if (!PyArg_ParseTuple(args, "s:purify_name_thread", &stringarg))
return NULL; return NULL;
status = purify_name_thread(stringarg); status = purify_name_thread(stringarg);
@ -666,7 +666,7 @@ pure_purify_watch_n(self, args)
char* type; char* type;
int status; int status;
if (!PyArg_ParseTuple(args, "lis", &addrrep, &size, &type)) if (!PyArg_ParseTuple(args, "lis:purify_watch_n", &addrrep, &size, &type))
return NULL; return NULL;
status = purify_watch_n((char*)addrrep, size, type); status = purify_watch_n((char*)addrrep, size, type);
@ -689,7 +689,7 @@ pure_purify_watch_remove(self, args)
int watchno; int watchno;
int status; int status;
if (!PyArg_ParseTuple(args, "i", &watchno)) if (!PyArg_ParseTuple(args, "i:purify_watch_remove", &watchno))
return NULL; return NULL;
status = purify_watch_remove(watchno); status = purify_watch_remove(watchno);
@ -711,7 +711,7 @@ pure_purify_describe(self, args)
long addrrep; long addrrep;
char* rtn; char* rtn;
if (!PyArg_ParseTuple(args, "l", &addrrep)) if (!PyArg_ParseTuple(args, "l:purify_describe", &addrrep))
return NULL; return NULL;
rtn = purify_describe((char*)addrrep); rtn = purify_describe((char*)addrrep);
@ -727,7 +727,7 @@ pure_purify_what_colors(self, args)
unsigned int size; unsigned int size;
int status; int status;
if (!PyArg_ParseTuple(args, "li", &addrrep, &size)) if (!PyArg_ParseTuple(args, "li:purify_what_colors", &addrrep, &size))
return NULL; return NULL;
status = purify_what_colors((char*)addrrep, size); status = purify_what_colors((char*)addrrep, size);
@ -772,7 +772,7 @@ pure_purify_exit(self, args)
{ {
int status; int status;
if (!PyArg_ParseTuple(args, "i", &status)) if (!PyArg_ParseTuple(args, "i:purify_exit", &status))
return NULL; return NULL;
/* purify_exit doesn't always act like exit(). See the manual */ /* purify_exit doesn't always act like exit(). See the manual */

View File

@ -50,7 +50,7 @@ parse_and_bind(self, args)
PyObject *args; PyObject *args;
{ {
char *s, *copy; char *s, *copy;
if (!PyArg_ParseTuple(args, "s", &s)) if (!PyArg_ParseTuple(args, "s:parse_and_bind", &s))
return NULL; return NULL;
/* Make a copy -- rl_parse_and_bind() modifies its argument */ /* Make a copy -- rl_parse_and_bind() modifies its argument */
/* Bernard Herzog */ /* Bernard Herzog */
@ -78,7 +78,7 @@ read_init_file(self, args)
PyObject *args; PyObject *args;
{ {
char *s = NULL; char *s = NULL;
if (!PyArg_ParseTuple(args, "|z", &s)) if (!PyArg_ParseTuple(args, "|z:read_init_file", &s))
return NULL; return NULL;
errno = rl_read_init_file(s); errno = rl_read_init_file(s);
if (errno) if (errno)
@ -146,7 +146,7 @@ set_completer_delims(self, args)
{ {
char *break_chars; char *break_chars;
if(!PyArg_ParseTuple(args, "s", &break_chars)) { if(!PyArg_ParseTuple(args, "s:set_completer_delims", &break_chars)) {
return NULL; return NULL;
} }
free(rl_completer_word_break_characters); free(rl_completer_word_break_characters);
@ -183,7 +183,7 @@ set_completer(self, args)
PyObject *args; PyObject *args;
{ {
PyObject *function = Py_None; PyObject *function = Py_None;
if (!PyArg_ParseTuple(args, "|O", &function)) if (!PyArg_ParseTuple(args, "|O:set_completer", &function))
return NULL; return NULL;
if (function == Py_None) { if (function == Py_None) {
Py_XDECREF(completer); Py_XDECREF(completer);
@ -239,7 +239,7 @@ insert_text(self, args)
PyObject *args; PyObject *args;
{ {
char *s; char *s;
if (!PyArg_ParseTuple(args, "s", &s)) if (!PyArg_ParseTuple(args, "s:insert_text", &s))
return NULL; return NULL;
rl_insert_text(s); rl_insert_text(s);
Py_INCREF(Py_None); Py_INCREF(Py_None);

View File

@ -119,7 +119,7 @@ regobj_match(re, args)
int offset = 0; int offset = 0;
int result; int result;
if (!PyArg_ParseTuple(args, "O|i", &argstring, &offset)) if (!PyArg_ParseTuple(args, "O|i:match", &argstring, &offset))
return NULL; return NULL;
if (!PyArg_Parse(argstring, "t#", &buffer, &size)) if (!PyArg_Parse(argstring, "t#", &buffer, &size))
return NULL; return NULL;
@ -158,9 +158,9 @@ regobj_search(re, args)
int range; int range;
int result; int result;
if (!PyArg_ParseTuple(args, "O|i", &argstring, &offset)) if (!PyArg_ParseTuple(args, "O|i:search", &argstring, &offset))
return NULL; return NULL;
if (!PyArg_Parse(argstring, "t#", &buffer, &size)) if (!PyArg_Parse(argstring, "t#:search", &buffer, &size))
return NULL; return NULL;
if (offset < 0 || offset > size) { if (offset < 0 || offset > size) {
@ -459,7 +459,7 @@ regex_compile(self, args)
PyObject *pat = NULL; PyObject *pat = NULL;
PyObject *tran = NULL; PyObject *tran = NULL;
if (!PyArg_ParseTuple(args, "S|S", &pat, &tran)) if (!PyArg_ParseTuple(args, "S|S:compile", &pat, &tran))
return NULL; return NULL;
return newregexobject(pat, tran, pat, NULL); return newregexobject(pat, tran, pat, NULL);
} }
@ -584,7 +584,7 @@ regex_symcomp(self, args)
PyObject *npattern; PyObject *npattern;
PyObject *retval = NULL; PyObject *retval = NULL;
if (!PyArg_ParseTuple(args, "S|S", &pattern, &tran)) if (!PyArg_ParseTuple(args, "S|S:symcomp", &pattern, &tran))
return NULL; return NULL;
gdict = PyDict_New(); gdict = PyDict_New();

View File

@ -60,7 +60,7 @@ resource_getrusage(self, args)
int who; int who;
struct rusage ru; struct rusage ru;
if (!PyArg_ParseTuple(args, "i", &who)) if (!PyArg_ParseTuple(args, "i:getrusage", &who))
return NULL; return NULL;
if (getrusage(who, &ru) == -1) { if (getrusage(who, &ru) == -1) {
@ -107,7 +107,7 @@ resource_getrlimit(self, args)
struct rlimit rl; struct rlimit rl;
int resource; int resource;
if (!PyArg_ParseTuple(args, "i", &resource)) if (!PyArg_ParseTuple(args, "i:getrlimit", &resource))
return NULL; return NULL;
if (resource < 0 || resource >= RLIM_NLIMITS) { if (resource < 0 || resource >= RLIM_NLIMITS) {
@ -140,7 +140,7 @@ resource_setrlimit(self, args)
int resource; int resource;
PyObject *curobj, *maxobj; PyObject *curobj, *maxobj;
if (!PyArg_ParseTuple(args, "i(OO)", &resource, &curobj, &maxobj)) if (!PyArg_ParseTuple(args, "i(OO):setrlimit", &resource, &curobj, &maxobj))
return NULL; return NULL;
if (resource < 0 || resource >= RLIM_NLIMITS) { if (resource < 0 || resource >= RLIM_NLIMITS) {
@ -182,7 +182,7 @@ resource_getpagesize(self, args)
PyObject *self; PyObject *self;
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":getpagesize"))
return NULL; return NULL;
return Py_BuildValue("i", getpagesize()); return Py_BuildValue("i", getpagesize());
} }

View File

@ -583,7 +583,7 @@ rotorobj_setkey(self, args)
{ {
char *key; char *key;
if (!PyArg_ParseTuple(args, "s", &key)) if (!PyArg_ParseTuple(args, "s:setkey", &key))
return NULL; return NULL;
set_key(self, key); set_key(self, key);
@ -639,7 +639,7 @@ rotor_rotor(self, args)
int len; int len;
int num_rotors = 6; 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; return NULL;
r = rotorobj_new(num_rotors, string); r = rotorobj_new(num_rotors, string);

View File

@ -243,7 +243,7 @@ select_select(self, args)
int n; int n;
/* convert arguments */ /* convert arguments */
if (!PyArg_ParseTuple(args, "OOO|O", if (!PyArg_ParseTuple(args, "OOO|O:select",
&ifdlist, &ofdlist, &efdlist, &tout)) &ifdlist, &ofdlist, &efdlist, &tout))
return NULL; return NULL;

View File

@ -548,7 +548,7 @@ SHA_new(self, args, kwdict)
if ((new = newSHAobject()) == NULL) if ((new = newSHAobject()) == NULL)
return NULL; return NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s#", kwlist, if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s#:new", kwlist,
&cp, &len)) { &cp, &len)) {
Py_DECREF(new); Py_DECREF(new);
return NULL; return NULL;

View File

@ -1096,7 +1096,7 @@ BUILD_FUNC_DEF_2(PySocketSock_makefile,PySocketSockObject *,s, PyObject *,args)
FILE *fp; FILE *fp;
PyObject *f; PyObject *f;
if (!PyArg_ParseTuple(args, "|si", &mode, &bufsize)) if (!PyArg_ParseTuple(args, "|si:makefile", &mode, &bufsize))
return NULL; return NULL;
#ifdef MS_WIN32 #ifdef MS_WIN32
if (((fd = _open_osfhandle(s->sock_fd, _O_BINARY)) < 0) || 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; int len, n, flags = 0;
PyObject *buf; PyObject *buf;
if (!PyArg_ParseTuple(args, "i|i", &len, &flags)) if (!PyArg_ParseTuple(args, "i|i:recv", &len, &flags))
return NULL; return NULL;
buf = PyString_FromStringAndSize((char *) 0, len); buf = PyString_FromStringAndSize((char *) 0, len);
if (buf == NULL) if (buf == NULL)
@ -1168,7 +1168,7 @@ BUILD_FUNC_DEF_2(PySocketSock_recvfrom,PySocketSockObject *,s, PyObject *,args)
PyObject *ret = NULL; PyObject *ret = NULL;
int addrlen, len, n, flags = 0; 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; return NULL;
if (!getsockaddrlen(s, &addrlen)) if (!getsockaddrlen(s, &addrlen))
return NULL; return NULL;
@ -1218,7 +1218,7 @@ BUILD_FUNC_DEF_2(PySocketSock_send,PySocketSockObject *,s, PyObject *,args)
{ {
char *buf; char *buf;
int len, n, flags = 0; 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; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
n = send(s->sock_fd, buf, len, flags); n = send(s->sock_fd, buf, len, flags);
@ -1702,7 +1702,7 @@ BUILD_FUNC_DEF_2(PySocket_socket,PyObject *,self, PyObject *,args)
int fd; int fd;
#endif #endif
int family, type, proto = 0; 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; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
fd = socket(family, type, proto); fd = socket(family, type, proto);
@ -1747,7 +1747,7 @@ BUILD_FUNC_DEF_2(PySocket_fromfd,PyObject *,self, PyObject *,args)
{ {
PySocketSockObject *s; PySocketSockObject *s;
int fd, family, type, proto = 0; 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; return NULL;
/* Dup the fd so it and the socket can be closed independently */ /* Dup the fd so it and the socket can be closed independently */
fd = dup(fd); fd = dup(fd);
@ -2015,7 +2015,7 @@ BUILD_FUNC_DEF_2(PySocket_ssl, PyObject *, self, PyObject *, args)
char *key_file; char *key_file;
char *cert_file; char *cert_file;
if (!PyArg_ParseTuple(args, "O!zz", if (!PyArg_ParseTuple(args, "O!zz:ssl",
&PySocketSock_Type, (PyObject*)&Sock, &PySocketSock_Type, (PyObject*)&Sock,
&key_file, &cert_file) ) &key_file, &cert_file) )
return NULL; return NULL;
@ -2094,7 +2094,7 @@ static PyObject *SSL_SSLwrite(SSLObject *self, PyObject *args)
char *data; char *data;
int len = 0; int len = 0;
if (!PyArg_ParseTuple(args, "s|i", &data, &len)) if (!PyArg_ParseTuple(args, "s|i:write", &data, &len))
return NULL; return NULL;
if (!len) if (!len)
@ -2111,7 +2111,7 @@ static PyObject *SSL_SSLread(SSLObject *self, PyObject *args)
int len = 1024; int len = 1024;
int res; int res;
PyArg_ParseTuple(args, "|i", &len); PyArg_ParseTuple(args, "|i:read", &len);
if (!(buf = PyString_FromStringAndSize((char *) 0, len))) if (!(buf = PyString_FromStringAndSize((char *) 0, len)))
return NULL; /* Error object should already be set */ return NULL; /* Error object should already be set */

View File

@ -125,7 +125,7 @@ get_soundex(PyObject *self, PyObject *args)
char *str; char *str;
char sdx[7]; char sdx[7];
if(!PyArg_ParseTuple( args, "s", &str)) if(!PyArg_ParseTuple( args, "s:get_soundex", &str))
return NULL; return NULL;
soundex_hash(str, sdx); soundex_hash(str, sdx);
@ -141,7 +141,7 @@ sound_similar(PyObject *self, PyObject *args)
char *str1, *str2; char *str1, *str2;
char res1[7], res2[7]; char res1[7], res2[7];
if(!PyArg_ParseTuple(args, "ss", &str1, &str2)) if(!PyArg_ParseTuple(args, "ss:sound_similar", &str1, &str2))
return NULL; return NULL;
soundex_hash(str1, res1); soundex_hash(str1, res1);

View File

@ -141,7 +141,7 @@ strop_splitfields(self, args)
n = 0; n = 0;
splitcount = 0; splitcount = 0;
maxsplit = 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; return NULL;
if (sub == NULL) if (sub == NULL)
return split_whitespace(s, len, maxsplit); return split_whitespace(s, len, maxsplit);
@ -211,7 +211,7 @@ strop_joinfields(self, args)
char* p = NULL; char* p = NULL;
intargfunc getitemfunc; intargfunc getitemfunc;
if (!PyArg_ParseTuple(args, "O|t#", &seq, &sep, &seplen)) if (!PyArg_ParseTuple(args, "O|t#:join", &seq, &sep, &seplen))
return NULL; return NULL;
if (sep == NULL) { if (sep == NULL) {
sep = " "; sep = " ";
@ -338,7 +338,7 @@ strop_find(self, args)
char *s, *sub; char *s, *sub;
int len, n, i = 0, last = INT_MAX; 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; return NULL;
if (last > len) if (last > len)
@ -383,7 +383,7 @@ strop_rfind(self, args)
int len, n, j; int len, n, j;
int i = 0, last = INT_MAX; 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; return NULL;
if (last > len) if (last > len)
@ -642,7 +642,7 @@ strop_expandtabs(self, args)
int tabsize = 8; int tabsize = 8;
/* Get arguments */ /* Get arguments */
if (!PyArg_ParseTuple(args, "s#|i", &string, &stringlen, &tabsize)) if (!PyArg_ParseTuple(args, "s#|i:expandtabs", &string, &stringlen, &tabsize))
return NULL; return NULL;
if (tabsize < 1) { if (tabsize < 1) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
@ -708,7 +708,7 @@ strop_count(self, args)
int i = 0, last = INT_MAX; int i = 0, last = INT_MAX;
int m, r; 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; return NULL;
if (last > len) if (last > len)
last = len; last = len;
@ -803,7 +803,7 @@ strop_atoi(self, args)
long x; long x;
char buffer[256]; /* For errors */ char buffer[256]; /* For errors */
if (!PyArg_ParseTuple(args, "s|i", &s, &base)) if (!PyArg_ParseTuple(args, "s|i:atoi", &s, &base))
return NULL; return NULL;
if ((base != 0 && base < 2) || base > 36) { if ((base != 0 && base < 2) || base > 36) {
@ -858,7 +858,7 @@ strop_atol(self, args)
PyObject *x; PyObject *x;
char buffer[256]; /* For errors */ char buffer[256]; /* For errors */
if (!PyArg_ParseTuple(args, "s|i", &s, &base)) if (!PyArg_ParseTuple(args, "s|i:atol", &s, &base))
return NULL; return NULL;
if ((base != 0 && base < 2) || base > 36) { if ((base != 0 && base < 2) || base > 36) {
@ -904,7 +904,7 @@ strop_atof(self, args)
double x; double x;
char buffer[256]; /* For errors */ char buffer[256]; /* For errors */
if (!PyArg_ParseTuple(args, "s", &s)) if (!PyArg_ParseTuple(args, "s:atof", &s))
return NULL; return NULL;
while (*s && isspace(Py_CHARMASK(*s))) while (*s && isspace(Py_CHARMASK(*s)))
s++; s++;
@ -948,7 +948,7 @@ strop_maketrans(self, args)
int i, fromlen=0, tolen=0; int i, fromlen=0, tolen=0;
PyObject *result; 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; return NULL;
if (fromlen != tolen) { if (fromlen != tolen) {
@ -991,7 +991,7 @@ strop_translate(self, args)
PyObject *result; PyObject *result;
int trans_table[256]; 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)) &table1, &tablen, &del_table, &dellen))
return NULL; return NULL;
if (tablen != 256) { if (tablen != 256) {
@ -1205,7 +1205,7 @@ strop_replace(self, args)
int count = 0; int count = 0;
PyObject *new; 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, &str, &len, &pat, &pat_len, &sub, &sub_len,
&count)) &count))
return NULL; return NULL;

View File

@ -1097,7 +1097,7 @@ struct_calcsize(self, args)
const formatdef *f; const formatdef *f;
int size; int size;
if (!PyArg_ParseTuple(args, "s", &fmt)) if (!PyArg_ParseTuple(args, "s:calcsize", &fmt))
return NULL; return NULL;
f = whichtable(&fmt); f = whichtable(&fmt);
size = calcsize(fmt, f); size = calcsize(fmt, f);
@ -1262,7 +1262,7 @@ struct_unpack(self, args)
int len, size, num; int len, size, num;
PyObject *res, *v; PyObject *res, *v;
if (!PyArg_ParseTuple(args, "ss#", &fmt, &start, &len)) if (!PyArg_ParseTuple(args, "ss#:unpack", &fmt, &start, &len))
return NULL; return NULL;
f = whichtable(&fmt); f = whichtable(&fmt);
size = calcsize(fmt, f); size = calcsize(fmt, f);

View File

@ -105,7 +105,7 @@ syslog_closelog(self, args)
PyObject * self; PyObject * self;
PyObject * args; PyObject * args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":closelog"))
return NULL; return NULL;
closelog(); closelog();
Py_XDECREF(S_ident_o); Py_XDECREF(S_ident_o);
@ -134,7 +134,7 @@ syslog_log_mask(self, args)
{ {
long mask; long mask;
long pri; long pri;
if (!PyArg_ParseTuple(args, "l", &pri)) if (!PyArg_ParseTuple(args, "l:LOG_MASK", &pri))
return NULL; return NULL;
mask = LOG_MASK(pri); mask = LOG_MASK(pri);
return PyInt_FromLong(mask); return PyInt_FromLong(mask);
@ -147,7 +147,7 @@ syslog_log_upto(self, args)
{ {
long mask; long mask;
long pri; long pri;
if (!PyArg_ParseTuple(args, "l", &pri)) if (!PyArg_ParseTuple(args, "l:LOG_UPTO", &pri))
return NULL; return NULL;
mask = LOG_UPTO(pri); mask = LOG_UPTO(pri);
return PyInt_FromLong(mask); return PyInt_FromLong(mask);

View File

@ -251,7 +251,7 @@ thread_PyThread_start_new_thread(self, fargs)
PyObject *func, *args = NULL, *keyw = NULL; PyObject *func, *args = NULL, *keyw = NULL;
struct bootstate *boot; 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; return NULL;
if (!PyCallable_Check(func)) { if (!PyCallable_Check(func)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,

View File

@ -373,7 +373,7 @@ time_strftime(self, args)
memset((ANY *) &buf, '\0', sizeof(buf)); 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; return NULL;
fmtlen = strlen(fmt); fmtlen = strlen(fmt);
@ -421,7 +421,7 @@ time_strptime(self, args)
char *buf; char *buf;
char *s; 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"); PyErr_SetString(PyExc_ValueError, "invalid argument");
return NULL; return NULL;
} }
@ -455,7 +455,7 @@ time_asctime(self, args)
PyObject *tup; PyObject *tup;
struct tm buf; struct tm buf;
char *p; char *p;
if (!PyArg_ParseTuple(args, "O", &tup)) if (!PyArg_ParseTuple(args, "O:asctime", &tup))
return NULL; return NULL;
if (!gettmarg(tup, &buf)) if (!gettmarg(tup, &buf))
return NULL; return NULL;
@ -506,7 +506,7 @@ time_mktime(self, args)
PyObject *tup; PyObject *tup;
struct tm buf; struct tm buf;
time_t tt; time_t tt;
if (!PyArg_ParseTuple(args, "O", &tup)) if (!PyArg_ParseTuple(args, "O:mktime", &tup))
return NULL; return NULL;
tt = time(&tt); tt = time(&tt);
buf = *localtime(&tt); buf = *localtime(&tt);

View File

@ -84,7 +84,7 @@ Xxo_demo(self, args)
XxoObject *self; XxoObject *self;
PyObject *args; PyObject *args;
{ {
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":demo"))
return NULL; return NULL;
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
@ -163,7 +163,7 @@ xx_foo(self, args)
{ {
long i, j; long i, j;
long res; long res;
if (!PyArg_ParseTuple(args, "ll", &i, &j)) if (!PyArg_ParseTuple(args, "ll:foo", &i, &j))
return NULL; return NULL;
res = i+j; /* XXX Do something here */ res = i+j; /* XXX Do something here */
return PyInt_FromLong(res); return PyInt_FromLong(res);
@ -179,7 +179,7 @@ xx_new(self, args)
{ {
XxoObject *rv; XxoObject *rv;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":new"))
return NULL; return NULL;
rv = newXxoObject(args); rv = newXxoObject(args);
if ( rv == NULL ) if ( rv == NULL )
@ -196,7 +196,7 @@ xx_bug(self, args)
{ {
PyObject *list, *item; PyObject *list, *item;
if (!PyArg_ParseTuple(args, "O", &list)) if (!PyArg_ParseTuple(args, "O:bug", &list))
return NULL; return NULL;
item = PyList_GetItem(list, 0); item = PyList_GetItem(list, 0);
@ -219,7 +219,7 @@ xx_roj(self, args)
{ {
PyObject *a; PyObject *a;
long b; long b;
if (!PyArg_ParseTuple(args, "O#", &a, &b)) if (!PyArg_ParseTuple(args, "O#:roj", &a, &b))
return NULL; return NULL;
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;

View File

@ -74,7 +74,7 @@ PyZlib_compress(self, args)
int length, level=Z_DEFAULT_COMPRESSION, err; int length, level=Z_DEFAULT_COMPRESSION, err;
z_stream zst; z_stream zst;
if (!PyArg_ParseTuple(args, "s#|i", &input, &length, &level)) if (!PyArg_ParseTuple(args, "s#|i:compress", &input, &length, &level))
return NULL; return NULL;
zst.avail_out = length + length/1000 + 12 + 1; zst.avail_out = length + length/1000 + 12 + 1;
output=(Byte*)malloc(zst.avail_out); output=(Byte*)malloc(zst.avail_out);
@ -172,7 +172,7 @@ PyZlib_decompress(self, args)
int length, err; int length, err;
int wsize=DEF_WBITS, r_strlen=DEFAULTALLOC; int wsize=DEF_WBITS, r_strlen=DEFAULTALLOC;
z_stream zst; 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; return NULL;
if (r_strlen <= 0) if (r_strlen <= 0)
@ -278,7 +278,7 @@ PyZlib_compressobj(selfptr, args)
int level=Z_DEFAULT_COMPRESSION, method=DEFLATED; int level=Z_DEFAULT_COMPRESSION, method=DEFLATED;
int wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=0, err; 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)) &memLevel, &strategy))
return NULL; return NULL;
@ -325,7 +325,7 @@ PyZlib_decompressobj(selfptr, args)
{ {
int wbits=DEF_WBITS, err; int wbits=DEF_WBITS, err;
compobject *self; compobject *self;
if (!PyArg_ParseTuple(args, "|i", &wbits)) if (!PyArg_ParseTuple(args, "|i:decompressobj", &wbits))
{ {
return NULL; return NULL;
} }
@ -403,7 +403,7 @@ PyZlib_objcompress(self, args)
Byte *input; Byte *input;
unsigned long start_total_out; unsigned long start_total_out;
if (!PyArg_ParseTuple(args, "s#", &input, &inplen)) if (!PyArg_ParseTuple(args, "s#:compress", &input, &inplen))
return NULL; return NULL;
self->zst.avail_in = inplen; self->zst.avail_in = inplen;
self->zst.next_in = input; self->zst.next_in = input;
@ -461,7 +461,7 @@ PyZlib_objdecompress(self, args)
Byte *input; Byte *input;
unsigned long start_total_out; unsigned long start_total_out;
if (!PyArg_ParseTuple(args, "s#", &input, &inplen)) if (!PyArg_ParseTuple(args, "s#:decompress", &input, &inplen))
return NULL; return NULL;
start_total_out = self->zst.total_out; start_total_out = self->zst.total_out;
RetVal = PyString_FromStringAndSize(NULL, DEFAULTALLOC); RetVal = PyString_FromStringAndSize(NULL, DEFAULTALLOC);
@ -535,7 +535,7 @@ PyZlib_flush(self, args)
int flushmode = Z_FINISH; int flushmode = Z_FINISH;
unsigned long start_total_out; unsigned long start_total_out;
if (!PyArg_ParseTuple(args, "|i", &flushmode)) if (!PyArg_ParseTuple(args, "|i:flush", &flushmode))
return NULL; return NULL;
/* Flushing with Z_NO_FLUSH is a no-op, so there's no point in /* 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; Byte *buf;
int len; int len;
if (!PyArg_ParseTuple(args, "s#|l", &buf, &len, &adler32val)) if (!PyArg_ParseTuple(args, "s#|l:adler32", &buf, &len, &adler32val))
{ {
return NULL; return NULL;
} }
@ -767,7 +767,7 @@ PyZlib_crc32(self, args)
uLong crc32val=crc32(0L, Z_NULL, 0); uLong crc32val=crc32(0L, Z_NULL, 0);
Byte *buf; Byte *buf;
int len; int len;
if (!PyArg_ParseTuple(args, "s#|l", &buf, &len, &crc32val)) if (!PyArg_ParseTuple(args, "s#|l:crc32", &buf, &len, &crc32val))
{ {
return NULL; return NULL;
} }

View File

@ -578,7 +578,7 @@ complex_conjugate(self, args)
PyObject *args; PyObject *args;
{ {
Py_complex c; Py_complex c;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":conjugate"))
return NULL; return NULL;
c = ((PyComplexObject *)self)->cval; c = ((PyComplexObject *)self)->cval;
c.imag = -c.imag; c.imag = -c.imag;

View File

@ -263,7 +263,7 @@ file_seek(f, args)
if (f->f_fp == NULL) if (f->f_fp == NULL)
return err_closed(); return err_closed();
whence = 0; whence = 0;
if (!PyArg_ParseTuple(args, "O|i", &offobj, &whence)) if (!PyArg_ParseTuple(args, "O|i:seek", &offobj, &whence))
return NULL; return NULL;
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
offset = PyInt_AsLong(offobj); offset = PyInt_AsLong(offobj);
@ -305,7 +305,7 @@ file_truncate(f, args)
if (f->f_fp == NULL) if (f->f_fp == NULL)
return err_closed(); return err_closed();
newsizeobj = NULL; newsizeobj = NULL;
if (!PyArg_ParseTuple(args, "|O", &newsizeobj)) if (!PyArg_ParseTuple(args, "|O:truncate", &newsizeobj))
return NULL; return NULL;
if (newsizeobj != NULL) { if (newsizeobj != NULL) {
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
@ -518,7 +518,7 @@ file_read(f, args)
if (f->f_fp == NULL) if (f->f_fp == NULL)
return err_closed(); return err_closed();
if (!PyArg_ParseTuple(args, "|l", &bytesrequested)) if (!PyArg_ParseTuple(args, "|l:read", &bytesrequested))
return NULL; return NULL;
if (bytesrequested < 0) if (bytesrequested < 0)
buffersize = new_buffersize(f, (size_t)0); buffersize = new_buffersize(f, (size_t)0);
@ -732,7 +732,7 @@ file_readline(f, args)
if (f->f_fp == NULL) if (f->f_fp == NULL)
return err_closed(); return err_closed();
if (!PyArg_ParseTuple(args, "|i", &n)) if (!PyArg_ParseTuple(args, "|i:readline", &n))
return NULL; return NULL;
if (n == 0) if (n == 0)
return PyString_FromString(""); return PyString_FromString("");
@ -761,7 +761,7 @@ file_readlines(f, args)
if (f->f_fp == NULL) if (f->f_fp == NULL)
return err_closed(); return err_closed();
if (!PyArg_ParseTuple(args, "|l", &sizehint)) if (!PyArg_ParseTuple(args, "|l:readlines", &sizehint))
return NULL; return NULL;
if ((list = PyList_New(0)) == NULL) if ((list = PyList_New(0)) == NULL)
return NULL; return NULL;

View File

@ -612,7 +612,7 @@ string_split(self, args)
n = 0; n = 0;
splitcount = 0; splitcount = 0;
maxsplit = 0; maxsplit = 0;
if (!PyArg_ParseTuple(args, "|z#i", &sub, &n, &maxsplit)) if (!PyArg_ParseTuple(args, "|z#i:split", &sub, &n, &maxsplit))
return NULL; return NULL;
if (sub == NULL) if (sub == NULL)
return split_whitespace(s, len, maxsplit); return split_whitespace(s, len, maxsplit);
@ -680,7 +680,7 @@ string_join(self, args)
int i, slen; int i, slen;
PyObject *seq; PyObject *seq;
if (!PyArg_ParseTuple(args, "O", &seq)) if (!PyArg_ParseTuple(args, "O:join", &seq))
return NULL; return NULL;
seqlen = PySequence_Length(seq); seqlen = PySequence_Length(seq);
@ -769,7 +769,7 @@ string_find_internal(self, args)
int len = PyString_GET_SIZE(self); int len = PyString_GET_SIZE(self);
int n, i = 0, last = INT_MAX; int n, i = 0, last = INT_MAX;
if (!PyArg_ParseTuple(args, "t#|ii", &sub, &n, &i, &last)) if (!PyArg_ParseTuple(args, "t#|ii:find", &sub, &n, &i, &last))
return -2; return -2;
if (last > len) if (last > len)
@ -848,7 +848,7 @@ string_rfind_internal(self, args)
int len = PyString_GET_SIZE(self), n, j; int len = PyString_GET_SIZE(self), n, j;
int i = 0, last = INT_MAX; int i = 0, last = INT_MAX;
if (!PyArg_ParseTuple(args, "t#|ii", &sub, &n, &i, &last)) if (!PyArg_ParseTuple(args, "t#|ii:rfind", &sub, &n, &i, &last))
return -2; return -2;
if (last > len) if (last > len)
@ -926,7 +926,7 @@ do_strip(self, args, striptype)
char *s = PyString_AS_STRING(self); char *s = PyString_AS_STRING(self);
int len = PyString_GET_SIZE(self), i, j; int len = PyString_GET_SIZE(self), i, j;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":strip"))
return NULL; return NULL;
i = 0; i = 0;
@ -1010,7 +1010,7 @@ string_lower(self, args)
int i, n = PyString_GET_SIZE(self); int i, n = PyString_GET_SIZE(self);
PyObject *new; PyObject *new;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":lower"))
return NULL; return NULL;
new = PyString_FromStringAndSize(NULL, n); new = PyString_FromStringAndSize(NULL, n);
if (new == NULL) if (new == NULL)
@ -1042,7 +1042,7 @@ string_upper(self, args)
int i, n = PyString_GET_SIZE(self); int i, n = PyString_GET_SIZE(self);
PyObject *new; PyObject *new;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":upper"))
return NULL; return NULL;
new = PyString_FromStringAndSize(NULL, n); new = PyString_FromStringAndSize(NULL, n);
if (new == NULL) if (new == NULL)
@ -1075,7 +1075,7 @@ string_capitalize(self, args)
int i, n = PyString_GET_SIZE(self); int i, n = PyString_GET_SIZE(self);
PyObject *new; PyObject *new;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":capitalize"))
return NULL; return NULL;
new = PyString_FromStringAndSize(NULL, n); new = PyString_FromStringAndSize(NULL, n);
if (new == NULL) if (new == NULL)
@ -1118,7 +1118,7 @@ string_count(self, args)
int i = 0, last = INT_MAX; int i = 0, last = INT_MAX;
int m, r; int m, r;
if (!PyArg_ParseTuple(args, "t#|ii", &sub, &n, &i, &last)) if (!PyArg_ParseTuple(args, "t#|ii:count", &sub, &n, &i, &last))
return NULL; return NULL;
if (last > len) if (last > len)
last = len; last = len;
@ -1162,7 +1162,7 @@ string_swapcase(self, args)
int i, n = PyString_GET_SIZE(self); int i, n = PyString_GET_SIZE(self);
PyObject *new; PyObject *new;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":swapcase"))
return NULL; return NULL;
new = PyString_FromStringAndSize(NULL, n); new = PyString_FromStringAndSize(NULL, n);
if (new == NULL) if (new == NULL)
@ -1205,7 +1205,7 @@ string_translate(self, args)
PyObject *result; PyObject *result;
int trans_table[256]; int trans_table[256];
if (!PyArg_ParseTuple(args, "t#|t#", if (!PyArg_ParseTuple(args, "t#|t#:translate",
&table1, &tablen, &del_table, &dellen)) &table1, &tablen, &del_table, &dellen))
return NULL; return NULL;
if (tablen != 256) { if (tablen != 256) {
@ -1422,7 +1422,7 @@ string_replace(self, args)
int count = 0; int count = 0;
PyObject *new; PyObject *new;
if (!PyArg_ParseTuple(args, "t#t#|i", if (!PyArg_ParseTuple(args, "t#t#|i:replace",
&pat, &pat_len, &sub, &sub_len, &count)) &pat, &pat_len, &sub, &sub_len, &count))
return NULL; return NULL;
if (pat_len <= 0) { if (pat_len <= 0) {
@ -1466,7 +1466,7 @@ string_startswith(self, args)
int start = 0; int start = 0;
int end = -1; int end = -1;
if (!PyArg_ParseTuple(args, "t#|ii", &prefix, &plen, &start, &end)) if (!PyArg_ParseTuple(args, "t#|ii:startswith", &prefix, &plen, &start, &end))
return NULL; return NULL;
/* adopt Java semantics for index out of range. it is legal for /* adopt Java semantics for index out of range. it is legal for
@ -1509,7 +1509,7 @@ string_endswith(self, args)
int end = -1; int end = -1;
int lower, upper; int lower, upper;
if (!PyArg_ParseTuple(args, "t#|ii", &suffix, &plen, &start, &end)) if (!PyArg_ParseTuple(args, "t#|ii:endswith", &suffix, &plen, &start, &end))
return NULL; return NULL;
if (start < 0 || start > len || plen > len) if (start < 0 || start > len || plen > len)

View File

@ -846,7 +846,7 @@ builtin_globals(self, args)
{ {
PyObject *d; PyObject *d;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":globals"))
return NULL; return NULL;
d = PyEval_GetGlobals(); d = PyEval_GetGlobals();
Py_INCREF(d); Py_INCREF(d);
@ -1212,7 +1212,7 @@ builtin_intern(self, args)
PyObject *args; PyObject *args;
{ {
PyObject *s; PyObject *s;
if (!PyArg_ParseTuple(args, "S", &s)) if (!PyArg_ParseTuple(args, "S:intern", &s))
return NULL; return NULL;
Py_INCREF(s); Py_INCREF(s);
PyString_InternInPlace(&s); PyString_InternInPlace(&s);
@ -1383,7 +1383,7 @@ builtin_locals(self, args)
{ {
PyObject *d; PyObject *d;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":locals"))
return NULL; return NULL;
d = PyEval_GetLocals(); d = PyEval_GetLocals();
Py_INCREF(d); Py_INCREF(d);
@ -2091,7 +2091,7 @@ builtin_isinstance(self, args)
static PyObject *__class__ = NULL; static PyObject *__class__ = NULL;
int retval = 0; int retval = 0;
if (!PyArg_ParseTuple(args, "OO", &inst, &cls)) if (!PyArg_ParseTuple(args, "OO:isinstance", &inst, &cls))
return NULL; return NULL;
if (PyClass_Check(cls)) { if (PyClass_Check(cls)) {
@ -2150,7 +2150,7 @@ builtin_issubclass(self, args)
PyObject *cls; PyObject *cls;
int retval; int retval;
if (!PyArg_ParseTuple(args, "OO", &derived, &cls)) if (!PyArg_ParseTuple(args, "OO:issubclass", &derived, &cls))
return NULL; return NULL;
if (!PyClass_Check(derived) || !PyClass_Check(cls)) { if (!PyClass_Check(derived) || !PyClass_Check(cls)) {

View File

@ -1951,7 +1951,7 @@ imp_get_magic(self, args)
{ {
char buf[4]; char buf[4];
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":get_magic"))
return NULL; return NULL;
buf[0] = (char) ((MAGIC >> 0) & 0xff); buf[0] = (char) ((MAGIC >> 0) & 0xff);
buf[1] = (char) ((MAGIC >> 8) & 0xff); buf[1] = (char) ((MAGIC >> 8) & 0xff);
@ -1969,7 +1969,7 @@ imp_get_suffixes(self, args)
PyObject *list; PyObject *list;
struct filedescr *fdp; struct filedescr *fdp;
if (!PyArg_ParseTuple(args, "")) if (!PyArg_ParseTuple(args, ":get_suffixes"))
return NULL; return NULL;
list = PyList_New(0); list = PyList_New(0);
if (list == NULL) if (list == NULL)
@ -2032,7 +2032,7 @@ imp_find_module(self, args)
{ {
char *name; char *name;
PyObject *path = NULL; PyObject *path = NULL;
if (!PyArg_ParseTuple(args, "s|O", &name, &path)) if (!PyArg_ParseTuple(args, "s|O:find_module", &name, &path))
return NULL; return NULL;
return call_find_module(name, path); return call_find_module(name, path);
} }
@ -2045,7 +2045,7 @@ imp_init_builtin(self, args)
char *name; char *name;
int ret; int ret;
PyObject *m; PyObject *m;
if (!PyArg_ParseTuple(args, "s", &name)) if (!PyArg_ParseTuple(args, "s:init_builtin", &name))
return NULL; return NULL;
ret = init_builtin(name); ret = init_builtin(name);
if (ret < 0) if (ret < 0)
@ -2067,7 +2067,7 @@ imp_init_frozen(self, args)
char *name; char *name;
int ret; int ret;
PyObject *m; PyObject *m;
if (!PyArg_ParseTuple(args, "s", &name)) if (!PyArg_ParseTuple(args, "s:init_frozen", &name))
return NULL; return NULL;
ret = PyImport_ImportFrozenModule(name); ret = PyImport_ImportFrozenModule(name);
if (ret < 0) if (ret < 0)
@ -2088,7 +2088,7 @@ imp_get_frozen_object(self, args)
{ {
char *name; char *name;
if (!PyArg_ParseTuple(args, "s", &name)) if (!PyArg_ParseTuple(args, "s:get_frozen_object", &name))
return NULL; return NULL;
return get_frozen_object(name); return get_frozen_object(name);
} }
@ -2099,7 +2099,7 @@ imp_is_builtin(self, args)
PyObject *args; PyObject *args;
{ {
char *name; char *name;
if (!PyArg_ParseTuple(args, "s", &name)) if (!PyArg_ParseTuple(args, "s:is_builtin", &name))
return NULL; return NULL;
return PyInt_FromLong(is_builtin(name)); return PyInt_FromLong(is_builtin(name));
} }
@ -2111,7 +2111,7 @@ imp_is_frozen(self, args)
{ {
char *name; char *name;
struct _frozen *p; struct _frozen *p;
if (!PyArg_ParseTuple(args, "s", &name)) if (!PyArg_ParseTuple(args, "s:is_frozen", &name))
return NULL; return NULL;
p = find_frozen(name); p = find_frozen(name);
return PyInt_FromLong((long) (p == NULL ? 0 : p->size)); return PyInt_FromLong((long) (p == NULL ? 0 : p->size));
@ -2148,7 +2148,7 @@ imp_load_compiled(self, args)
PyObject *fob = NULL; PyObject *fob = NULL;
PyObject *m; PyObject *m;
FILE *fp; FILE *fp;
if (!PyArg_ParseTuple(args, "ss|O!", &name, &pathname, if (!PyArg_ParseTuple(args, "ss|O!:load_compiled", &name, &pathname,
&PyFile_Type, &fob)) &PyFile_Type, &fob))
return NULL; return NULL;
fp = get_file(pathname, fob, "rb"); fp = get_file(pathname, fob, "rb");
@ -2172,7 +2172,7 @@ imp_load_dynamic(self, args)
PyObject *fob = NULL; PyObject *fob = NULL;
PyObject *m; PyObject *m;
FILE *fp = NULL; FILE *fp = NULL;
if (!PyArg_ParseTuple(args, "ss|O!", &name, &pathname, if (!PyArg_ParseTuple(args, "ss|O!:load_dynamic", &name, &pathname,
&PyFile_Type, &fob)) &PyFile_Type, &fob))
return NULL; return NULL;
if (fob) { if (fob) {
@ -2196,7 +2196,7 @@ imp_load_source(self, args)
PyObject *fob = NULL; PyObject *fob = NULL;
PyObject *m; PyObject *m;
FILE *fp; FILE *fp;
if (!PyArg_ParseTuple(args, "ss|O!", &name, &pathname, if (!PyArg_ParseTuple(args, "ss|O!:load_source", &name, &pathname,
&PyFile_Type, &fob)) &PyFile_Type, &fob))
return NULL; return NULL;
fp = get_file(pathname, fob, "r"); fp = get_file(pathname, fob, "r");
@ -2218,7 +2218,7 @@ imp_load_resource(self, args)
char *pathname; char *pathname;
PyObject *m; PyObject *m;
if (!PyArg_ParseTuple(args, "ss", &name, &pathname)) if (!PyArg_ParseTuple(args, "ss:load_resource", &name, &pathname))
return NULL; return NULL;
m = PyMac_LoadResourceModule(name, pathname); m = PyMac_LoadResourceModule(name, pathname);
return m; return m;
@ -2238,7 +2238,7 @@ imp_load_module(self, args)
int type; int type;
FILE *fp; FILE *fp;
if (!PyArg_ParseTuple(args, "sOs(ssi)", if (!PyArg_ParseTuple(args, "sOs(ssi):load_module",
&name, &fob, &pathname, &name, &fob, &pathname,
&suffix, &mode, &type)) &suffix, &mode, &type))
return NULL; return NULL;
@ -2269,7 +2269,7 @@ imp_load_package(self, args)
{ {
char *name; char *name;
char *pathname; char *pathname;
if (!PyArg_ParseTuple(args, "ss", &name, &pathname)) if (!PyArg_ParseTuple(args, "ss:load_package", &name, &pathname))
return NULL; return NULL;
return load_package(name, pathname); return load_package(name, pathname);
} }
@ -2280,7 +2280,7 @@ imp_new_module(self, args)
PyObject *args; PyObject *args;
{ {
char *name; char *name;
if (!PyArg_ParseTuple(args, "s", &name)) if (!PyArg_ParseTuple(args, "s:new_module", &name))
return NULL; return NULL;
return PyModule_New(name); return PyModule_New(name);
} }

View File

@ -192,7 +192,7 @@ sys_setcheckinterval(self, args)
PyObject *args; PyObject *args;
{ {
PyThreadState *tstate = PyThreadState_Get(); PyThreadState *tstate = PyThreadState_Get();
if (!PyArg_ParseTuple(args, "i", &tstate->interp->checkinterval)) if (!PyArg_ParseTuple(args, "i:setcheckinterval", &tstate->interp->checkinterval))
return NULL; return NULL;
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;