Skip to content

Commit

Permalink
Massive patch by Skip Montanaro to add ":name" to as many
Browse files Browse the repository at this point in the history
PyArg_ParseTuple() format string arguments as possible.


git-svn-id: http://svn.python.org/projects/python/trunk@14535 6015fed2-1504-0410-9fe1-9d1591cc4771
  • Loading branch information
guido committed Feb 29, 2000
1 parent 01e40aa commit 4147803
Show file tree
Hide file tree
Showing 37 changed files with 272 additions and 272 deletions.
6 changes: 3 additions & 3 deletions Modules/_localemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ PyLocale_setlocale(self,args)
char *locale=0,*result;
PyObject *result_object;
struct lconv *lc;
if(!PyArg_ParseTuple(args,"i|z",&category,&locale))return 0;
if(!PyArg_ParseTuple(args,"i|z:setlocale",&category,&locale))return 0;
if(locale){
/* set locale */
result=setlocale(category,locale);
Expand Down Expand Up @@ -266,7 +266,7 @@ PyLocale_strcoll(self,args)
PyObject *args;
{
char *s1,*s2;
if(!PyArg_ParseTuple(args,"ss",&s1,&s2))
if(!PyArg_ParseTuple(args,"ss:strcoll",&s1,&s2))
return NULL;
return PyInt_FromLong(strcoll(s1,s2));
}
Expand All @@ -283,7 +283,7 @@ PyLocale_strxfrm(self,args)
char *s,*buf;
int n1,n2;
PyObject *result;
if(!PyArg_ParseTuple(args,"s",&s))
if(!PyArg_ParseTuple(args,"s:strxfrm",&s))
return NULL;
/* assume no change in size, first */
n1=strlen(s)+1;
Expand Down
56 changes: 28 additions & 28 deletions Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ Tkapp_Eval(self, args)
PyObject *res = NULL;
int err;

if (!PyArg_ParseTuple(args, "s", &script))
if (!PyArg_ParseTuple(args, "s:eval", &script))
return NULL;

ENTER_TCL
Expand All @@ -720,7 +720,7 @@ Tkapp_GlobalEval(self, args)
PyObject *res = NULL;
int err;

if (!PyArg_ParseTuple(args, "s", &script))
if (!PyArg_ParseTuple(args, "s:globaleval", &script))
return NULL;

ENTER_TCL
Expand All @@ -743,7 +743,7 @@ Tkapp_EvalFile(self, args)
PyObject *res = NULL;
int err;

if (!PyArg_ParseTuple(args, "s", &fileName))
if (!PyArg_ParseTuple(args, "s:evalfile", &fileName))
return NULL;

ENTER_TCL
Expand Down Expand Up @@ -788,7 +788,7 @@ Tkapp_AddErrorInfo(self, args)
{
char *msg;

if (!PyArg_ParseTuple(args, "s", &msg))
if (!PyArg_ParseTuple(args, "s:adderrorinfo", &msg))
return NULL;
ENTER_TCL
Tcl_AddErrorInfo(Tkapp_Interp(self), msg);
Expand Down Expand Up @@ -816,7 +816,7 @@ SetVar(self, args, flags)
if (!tmp)
return NULL;

if (PyArg_ParseTuple(args, "sO", &name1, &newValue)) {
if (PyArg_ParseTuple(args, "sO:setvar", &name1, &newValue)) {
/* XXX Merge? */
s = AsString(newValue, tmp);
ENTER_TCL
Expand All @@ -825,7 +825,7 @@ SetVar(self, args, flags)
}
else {
PyErr_Clear();
if (PyArg_ParseTuple(args, "ssO", &name1, &name2, &newValue)) {
if (PyArg_ParseTuple(args, "ssO:setvar", &name1, &name2, &newValue)) {
s = AsString (newValue, tmp);
ENTER_TCL
ok = Tcl_SetVar2(Tkapp_Interp(self), name1, name2,
Expand Down Expand Up @@ -873,7 +873,7 @@ GetVar(self, args, flags)
char *name1, *name2=NULL, *s;
PyObject *res = NULL;

if (!PyArg_ParseTuple(args, "s|s", &name1, &name2))
if (!PyArg_ParseTuple(args, "s|s:getvar", &name1, &name2))
return NULL;
ENTER_TCL
if (name2 == NULL)
Expand Down Expand Up @@ -919,7 +919,7 @@ UnsetVar(self, args, flags)
PyObject *res = NULL;
int code;

if (!PyArg_ParseTuple(args, "s|s", &name1, &name2))
if (!PyArg_ParseTuple(args, "s|s:unsetvar", &name1, &name2))
return NULL;
ENTER_TCL
if (name2 == NULL)
Expand Down Expand Up @@ -967,7 +967,7 @@ Tkapp_GetInt(self, args)
char *s;
int v;

if (!PyArg_ParseTuple(args, "s", &s))
if (!PyArg_ParseTuple(args, "s:getint", &s))
return NULL;
if (Tcl_GetInt(Tkapp_Interp(self), s, &v) == TCL_ERROR)
return Tkinter_Error(self);
Expand All @@ -982,7 +982,7 @@ Tkapp_GetDouble(self, args)
char *s;
double v;

if (!PyArg_ParseTuple(args, "s", &s))
if (!PyArg_ParseTuple(args, "s:getdouble", &s))
return NULL;
if (Tcl_GetDouble(Tkapp_Interp(self), s, &v) == TCL_ERROR)
return Tkinter_Error(self);
Expand All @@ -997,7 +997,7 @@ Tkapp_GetBoolean(self, args)
char *s;
int v;

if (!PyArg_ParseTuple(args, "s", &s))
if (!PyArg_ParseTuple(args, "s:getboolean", &s))
return NULL;
if (Tcl_GetBoolean(Tkapp_Interp(self), s, &v) == TCL_ERROR)
return Tkinter_Error(self);
Expand All @@ -1013,7 +1013,7 @@ Tkapp_ExprString(self, args)
PyObject *res = NULL;
int retval;

if (!PyArg_ParseTuple(args, "s", &s))
if (!PyArg_ParseTuple(args, "s:exprstring", &s))
return NULL;
ENTER_TCL
retval = Tcl_ExprString(Tkapp_Interp(self), s);
Expand All @@ -1036,7 +1036,7 @@ Tkapp_ExprLong(self, args)
int retval;
long v;

if (!PyArg_ParseTuple(args, "s", &s))
if (!PyArg_ParseTuple(args, "s:exprlong", &s))
return NULL;
ENTER_TCL
retval = Tcl_ExprLong(Tkapp_Interp(self), s, &v);
Expand All @@ -1059,7 +1059,7 @@ Tkapp_ExprDouble(self, args)
double v;
int retval;

if (!PyArg_ParseTuple(args, "s", &s))
if (!PyArg_ParseTuple(args, "s:exprdouble", &s))
return NULL;
PyFPE_START_PROTECT("Tkapp_ExprDouble", return 0)
ENTER_TCL
Expand All @@ -1084,7 +1084,7 @@ Tkapp_ExprBoolean(self, args)
int retval;
int v;

if (!PyArg_ParseTuple(args, "s", &s))
if (!PyArg_ParseTuple(args, "s:exprboolean", &s))
return NULL;
ENTER_TCL
retval = Tcl_ExprBoolean(Tkapp_Interp(self), s, &v);
Expand All @@ -1110,7 +1110,7 @@ Tkapp_SplitList(self, args)
PyObject *v;
int i;

if (!PyArg_ParseTuple(args, "s", &list))
if (!PyArg_ParseTuple(args, "s:splitlist", &list))
return NULL;

if (Tcl_SplitList(Tkapp_Interp(self), list, &argc, &argv) == TCL_ERROR)
Expand Down Expand Up @@ -1140,7 +1140,7 @@ Tkapp_Split(self, args)
{
char *list;

if (!PyArg_ParseTuple(args, "s", &list))
if (!PyArg_ParseTuple(args, "s:split", &list))
return NULL;
return Split(list);
}
Expand Down Expand Up @@ -1261,7 +1261,7 @@ Tkapp_CreateCommand(self, args)
PyObject *func;
Tcl_Command err;

if (!PyArg_ParseTuple(args, "sO", &cmdName, &func))
if (!PyArg_ParseTuple(args, "sO:createcommand", &cmdName, &func))
return NULL;
if (!PyCallable_Check(func)) {
PyErr_SetString(PyExc_TypeError, "command not callable");
Expand Down Expand Up @@ -1300,7 +1300,7 @@ Tkapp_DeleteCommand(self, args)
char *cmdName;
int err;

if (!PyArg_ParseTuple(args, "s", &cmdName))
if (!PyArg_ParseTuple(args, "s:deletecommand", &cmdName))
return NULL;
ENTER_TCL
err = Tcl_DeleteCommand(Tkapp_Interp(self), cmdName);
Expand Down Expand Up @@ -1443,7 +1443,7 @@ Tkapp_CreateFileHandler(self, args)
int mask, id;
FHANDLE tfile;

if (!PyArg_ParseTuple(args, "OiO", &file, &mask, &func))
if (!PyArg_ParseTuple(args, "OiO:createfilehandler", &file, &mask, &func))
return NULL;
id = GetFileNo(file);
if (id < 0)
Expand Down Expand Up @@ -1476,7 +1476,7 @@ Tkapp_DeleteFileHandler(self, args)
int id;
FHANDLE tfile;

if (!PyArg_ParseTuple(args, "O", &file))
if (!PyArg_ParseTuple(args, "O:deletefilehandler", &file))
return NULL;
id = GetFileNo(file);
if (id < 0)
Expand Down Expand Up @@ -1513,7 +1513,7 @@ Tktt_DeleteTimerHandler(self, args)
TkttObject *v = (TkttObject *)self;
PyObject *func = v->func;

if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, ":deletetimerhandler"))
return NULL;
if (v->token != NULL) {
Tcl_DeleteTimerHandler(v->token);
Expand Down Expand Up @@ -1646,7 +1646,7 @@ Tkapp_CreateTimerHandler(self, args)
PyObject *func;
TkttObject *v;

if (!PyArg_ParseTuple(args, "iO", &milliseconds, &func))
if (!PyArg_ParseTuple(args, "iO:createtimerhandler", &milliseconds, &func))
return NULL;
if (!PyCallable_Check(func)) {
PyErr_SetString(PyExc_TypeError, "bad argument list");
Expand All @@ -1672,7 +1672,7 @@ Tkapp_MainLoop(self, args)
PyThreadState *tstate = PyThreadState_Get();
#endif

if (!PyArg_ParseTuple(args, "|i", &threshold))
if (!PyArg_ParseTuple(args, "|i:mainloop", &threshold))
return NULL;

quitMainLoop = 0;
Expand Down Expand Up @@ -1721,7 +1721,7 @@ Tkapp_DoOneEvent(self, args)
int flags = 0;
int rv;

if (!PyArg_ParseTuple(args, "|i", &flags))
if (!PyArg_ParseTuple(args, "|i:dooneevent", &flags))
return NULL;

ENTER_TCL
Expand All @@ -1736,7 +1736,7 @@ Tkapp_Quit(self, args)
PyObject *args;
{

if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, ":quit"))
return NULL;

quitMainLoop = 1;
Expand All @@ -1750,7 +1750,7 @@ Tkapp_InterpAddr(self, args)
PyObject *args;
{

if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, ":interpaddr"))
return NULL;

return PyInt_FromLong((long)Tkapp_Interp(self));
Expand Down Expand Up @@ -1862,7 +1862,7 @@ Tkinter_Create(self, args)
baseName = Py_GetProgramName();
className = "Tk";

if (!PyArg_ParseTuple(args, "|zssi",
if (!PyArg_ParseTuple(args, "|zssi:create",
&screenName, &baseName, &className,
&interactive))
return NULL;
Expand Down
Loading

0 comments on commit 4147803

Please sign in to comment.