[Python-checkins] r55504 - python/trunk/Modules/_tkinter.c

Neal Norwitz nnorwitz at gmail.com
Tue May 22 09:51:39 CEST 2007


On 5/22/07, Georg Brandl <g.brandl at gmx.net> wrote:
> neal.norwitz schrieb:
> > Author: neal.norwitz
> > Date: Tue May 22 09:16:10 2007
> > New Revision: 55504
> >
> > Modified:
> >    python/trunk/Modules/_tkinter.c
> > Log:
> > Stop using METH_OLDARGS
> >
> > Modified: python/trunk/Modules/_tkinter.c
> > ==============================================================================
> > --- python/trunk/Modules/_tkinter.c   (original)
> > +++ python/trunk/Modules/_tkinter.c   Tue May 22 09:16:10 2007
> > @@ -2698,8 +2698,8 @@
> >  {
> >       {"willdispatch",       Tkapp_WillDispatch, METH_NOARGS},
> >       {"wantobjects",        Tkapp_WantObjects, METH_VARARGS},
> > -     {"call",               Tkapp_Call, METH_OLDARGS},
> > -     {"globalcall",         Tkapp_GlobalCall, METH_OLDARGS},
> > +     {"call",               Tkapp_Call, METH_VARARGS},
> > +     {"globalcall",         Tkapp_GlobalCall, METH_VARARGS},
> >       {"eval",               Tkapp_Eval, METH_VARARGS},
> >       {"globaleval",         Tkapp_GlobalEval, METH_VARARGS},
> >       {"evalfile",           Tkapp_EvalFile, METH_VARARGS},
> > @@ -2720,7 +2720,7 @@
> >       {"exprboolean",        Tkapp_ExprBoolean, METH_VARARGS},
> >       {"splitlist",          Tkapp_SplitList, METH_VARARGS},
> >       {"split",              Tkapp_Split, METH_VARARGS},
> > -     {"merge",              Tkapp_Merge, METH_OLDARGS},
> > +     {"merge",              Tkapp_Merge, METH_VARARGS},
> >       {"createcommand",      Tkapp_CreateCommand, METH_VARARGS},
> >       {"deletecommand",      Tkapp_DeleteCommand, METH_VARARGS},
> >  #ifdef HAVE_CREATEFILEHANDLER
>
> Don't you have to adapt the functions that used to use oldargs too?
> At least, you can remove the cases for args == NULL and args not being a tuple.

Normally, yes.  In this case, it looked like all the methods calls
into Merge() which handles NULL, tuples, and non-tuples. ~lines 385 -
400.  I wasn't sure if any of that code could be removed though.
(Looking through the code, it does look like these other conditions
might be dead now.  But I didn't look that closely.)  This could use
some extra testing.  Let me know if you see something I screwed up.

In the case of the other checkin where METH_OLDARGS was implicitly
used with METH_KEYWORDS, this case was handled the same as
METH_VARARGS.  So no code needed to change when adding METH_VARARGS.

n


More information about the Python-checkins mailing list