Skip to content

Commit f09907a

Browse files
author
loewis
committed
Patch #477750: Use METH_ constants in Modules.
git-svn-id: http://svn.python.org/projects/python/trunk@25117 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 2a15b79 commit f09907a

27 files changed

Lines changed: 449 additions & 449 deletions

Modules/_codecsmodule.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -667,37 +667,37 @@ mbcs_encode(PyObject *self,
667667
/* --- Module API --------------------------------------------------------- */
668668

669669
static PyMethodDef _codecs_functions[] = {
670-
{"register", codecregister, 1},
671-
{"lookup", codeclookup, 1},
670+
{"register", codecregister, METH_VARARGS},
671+
{"lookup", codeclookup, METH_VARARGS},
672672
#ifdef Py_USING_UNICODE
673-
{"utf_8_encode", utf_8_encode, 1},
674-
{"utf_8_decode", utf_8_decode, 1},
675-
{"utf_7_encode", utf_7_encode, 1},
676-
{"utf_7_decode", utf_7_decode, 1},
677-
{"utf_16_encode", utf_16_encode, 1},
678-
{"utf_16_le_encode", utf_16_le_encode, 1},
679-
{"utf_16_be_encode", utf_16_be_encode, 1},
680-
{"utf_16_decode", utf_16_decode, 1},
681-
{"utf_16_le_decode", utf_16_le_decode, 1},
682-
{"utf_16_be_decode", utf_16_be_decode, 1},
683-
{"utf_16_ex_decode", utf_16_ex_decode, 1},
684-
{"unicode_escape_encode", unicode_escape_encode, 1},
685-
{"unicode_escape_decode", unicode_escape_decode, 1},
686-
{"unicode_internal_encode", unicode_internal_encode, 1},
687-
{"unicode_internal_decode", unicode_internal_decode, 1},
688-
{"raw_unicode_escape_encode", raw_unicode_escape_encode, 1},
689-
{"raw_unicode_escape_decode", raw_unicode_escape_decode, 1},
690-
{"latin_1_encode", latin_1_encode, 1},
691-
{"latin_1_decode", latin_1_decode, 1},
692-
{"ascii_encode", ascii_encode, 1},
693-
{"ascii_decode", ascii_decode, 1},
694-
{"charmap_encode", charmap_encode, 1},
695-
{"charmap_decode", charmap_decode, 1},
696-
{"readbuffer_encode", readbuffer_encode, 1},
697-
{"charbuffer_encode", charbuffer_encode, 1},
673+
{"utf_8_encode", utf_8_encode, METH_VARARGS},
674+
{"utf_8_decode", utf_8_decode, METH_VARARGS},
675+
{"utf_7_encode", utf_7_encode, METH_VARARGS},
676+
{"utf_7_decode", utf_7_decode, METH_VARARGS},
677+
{"utf_16_encode", utf_16_encode, METH_VARARGS},
678+
{"utf_16_le_encode", utf_16_le_encode, METH_VARARGS},
679+
{"utf_16_be_encode", utf_16_be_encode, METH_VARARGS},
680+
{"utf_16_decode", utf_16_decode, METH_VARARGS},
681+
{"utf_16_le_decode", utf_16_le_decode, METH_VARARGS},
682+
{"utf_16_be_decode", utf_16_be_decode, METH_VARARGS},
683+
{"utf_16_ex_decode", utf_16_ex_decode, METH_VARARGS},
684+
{"unicode_escape_encode", unicode_escape_encode, METH_VARARGS},
685+
{"unicode_escape_decode", unicode_escape_decode, METH_VARARGS},
686+
{"unicode_internal_encode", unicode_internal_encode, METH_VARARGS},
687+
{"unicode_internal_decode", unicode_internal_decode, METH_VARARGS},
688+
{"raw_unicode_escape_encode", raw_unicode_escape_encode, METH_VARARGS},
689+
{"raw_unicode_escape_decode", raw_unicode_escape_decode, METH_VARARGS},
690+
{"latin_1_encode", latin_1_encode, METH_VARARGS},
691+
{"latin_1_decode", latin_1_decode, METH_VARARGS},
692+
{"ascii_encode", ascii_encode, METH_VARARGS},
693+
{"ascii_decode", ascii_decode, METH_VARARGS},
694+
{"charmap_encode", charmap_encode, METH_VARARGS},
695+
{"charmap_decode", charmap_decode, METH_VARARGS},
696+
{"readbuffer_encode", readbuffer_encode, METH_VARARGS},
697+
{"charbuffer_encode", charbuffer_encode, METH_VARARGS},
698698
#if defined(MS_WIN32) && defined(HAVE_USABLE_WCHAR_T)
699-
{"mbcs_encode", mbcs_encode, 1},
700-
{"mbcs_decode", mbcs_decode, 1},
699+
{"mbcs_encode", mbcs_encode, METH_VARARGS},
700+
{"mbcs_decode", mbcs_decode, METH_VARARGS},
701701
#endif
702702
#endif /* Py_USING_UNICODE */
703703
{NULL, NULL} /* sentinel */

Modules/_tkinter.c

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,40 +1763,40 @@ Tkapp_InterpAddr(PyObject *self, PyObject *args)
17631763

17641764
static PyMethodDef Tkapp_methods[] =
17651765
{
1766-
{"call", Tkapp_Call, 0},
1767-
{"globalcall", Tkapp_GlobalCall, 0},
1768-
{"eval", Tkapp_Eval, 1},
1769-
{"globaleval", Tkapp_GlobalEval, 1},
1770-
{"evalfile", Tkapp_EvalFile, 1},
1771-
{"record", Tkapp_Record, 1},
1772-
{"adderrorinfo", Tkapp_AddErrorInfo, 1},
1773-
{"setvar", Tkapp_SetVar, 1},
1774-
{"globalsetvar", Tkapp_GlobalSetVar, 1},
1775-
{"getvar", Tkapp_GetVar, 1},
1776-
{"globalgetvar", Tkapp_GlobalGetVar, 1},
1777-
{"unsetvar", Tkapp_UnsetVar, 1},
1778-
{"globalunsetvar", Tkapp_GlobalUnsetVar, 1},
1779-
{"getint", Tkapp_GetInt, 1},
1780-
{"getdouble", Tkapp_GetDouble, 1},
1781-
{"getboolean", Tkapp_GetBoolean, 1},
1782-
{"exprstring", Tkapp_ExprString, 1},
1783-
{"exprlong", Tkapp_ExprLong, 1},
1784-
{"exprdouble", Tkapp_ExprDouble, 1},
1785-
{"exprboolean", Tkapp_ExprBoolean, 1},
1786-
{"splitlist", Tkapp_SplitList, 1},
1787-
{"split", Tkapp_Split, 1},
1788-
{"merge", Tkapp_Merge, 0},
1789-
{"createcommand", Tkapp_CreateCommand, 1},
1790-
{"deletecommand", Tkapp_DeleteCommand, 1},
1766+
{"call", Tkapp_Call, METH_OLDARGS},
1767+
{"globalcall", Tkapp_GlobalCall, METH_OLDARGS},
1768+
{"eval", Tkapp_Eval, METH_VARARGS},
1769+
{"globaleval", Tkapp_GlobalEval, METH_VARARGS},
1770+
{"evalfile", Tkapp_EvalFile, METH_VARARGS},
1771+
{"record", Tkapp_Record, METH_VARARGS},
1772+
{"adderrorinfo", Tkapp_AddErrorInfo, METH_VARARGS},
1773+
{"setvar", Tkapp_SetVar, METH_VARARGS},
1774+
{"globalsetvar", Tkapp_GlobalSetVar, METH_VARARGS},
1775+
{"getvar", Tkapp_GetVar, METH_VARARGS},
1776+
{"globalgetvar", Tkapp_GlobalGetVar, METH_VARARGS},
1777+
{"unsetvar", Tkapp_UnsetVar, METH_VARARGS},
1778+
{"globalunsetvar", Tkapp_GlobalUnsetVar, METH_VARARGS},
1779+
{"getint", Tkapp_GetInt, METH_VARARGS},
1780+
{"getdouble", Tkapp_GetDouble, METH_VARARGS},
1781+
{"getboolean", Tkapp_GetBoolean, METH_VARARGS},
1782+
{"exprstring", Tkapp_ExprString, METH_VARARGS},
1783+
{"exprlong", Tkapp_ExprLong, METH_VARARGS},
1784+
{"exprdouble", Tkapp_ExprDouble, METH_VARARGS},
1785+
{"exprboolean", Tkapp_ExprBoolean, METH_VARARGS},
1786+
{"splitlist", Tkapp_SplitList, METH_VARARGS},
1787+
{"split", Tkapp_Split, METH_VARARGS},
1788+
{"merge", Tkapp_Merge, METH_OLDARGS},
1789+
{"createcommand", Tkapp_CreateCommand, METH_VARARGS},
1790+
{"deletecommand", Tkapp_DeleteCommand, METH_VARARGS},
17911791
#ifdef HAVE_CREATEFILEHANDLER
1792-
{"createfilehandler", Tkapp_CreateFileHandler, 1},
1793-
{"deletefilehandler", Tkapp_DeleteFileHandler, 1},
1792+
{"createfilehandler", Tkapp_CreateFileHandler, METH_VARARGS},
1793+
{"deletefilehandler", Tkapp_DeleteFileHandler, METH_VARARGS},
17941794
#endif
1795-
{"createtimerhandler", Tkapp_CreateTimerHandler, 1},
1796-
{"mainloop", Tkapp_MainLoop, 1},
1797-
{"dooneevent", Tkapp_DoOneEvent, 1},
1798-
{"quit", Tkapp_Quit, 1},
1799-
{"interpaddr", Tkapp_InterpAddr, 1},
1795+
{"createtimerhandler", Tkapp_CreateTimerHandler, METH_VARARGS},
1796+
{"mainloop", Tkapp_MainLoop, METH_VARARGS},
1797+
{"dooneevent", Tkapp_DoOneEvent, METH_VARARGS},
1798+
{"quit", Tkapp_Quit, METH_VARARGS},
1799+
{"interpaddr", Tkapp_InterpAddr, METH_VARARGS},
18001800
{NULL, NULL}
18011801
};
18021802

@@ -1978,16 +1978,16 @@ Tkinter_Create(PyObject *self, PyObject *args)
19781978

19791979
static PyMethodDef moduleMethods[] =
19801980
{
1981-
{"_flatten", Tkinter_Flatten, 1},
1982-
{"create", Tkinter_Create, 1},
1981+
{"_flatten", Tkinter_Flatten, METH_VARARGS},
1982+
{"create", Tkinter_Create, METH_VARARGS},
19831983
#ifdef HAVE_CREATEFILEHANDLER
1984-
{"createfilehandler", Tkapp_CreateFileHandler, 1},
1985-
{"deletefilehandler", Tkapp_DeleteFileHandler, 1},
1984+
{"createfilehandler", Tkapp_CreateFileHandler, METH_VARARGS},
1985+
{"deletefilehandler", Tkapp_DeleteFileHandler, METH_VARARGS},
19861986
#endif
1987-
{"createtimerhandler", Tkapp_CreateTimerHandler, 1},
1988-
{"mainloop", Tkapp_MainLoop, 1},
1989-
{"dooneevent", Tkapp_DoOneEvent, 1},
1990-
{"quit", Tkapp_Quit, 1},
1987+
{"createtimerhandler", Tkapp_CreateTimerHandler, METH_VARARGS},
1988+
{"mainloop", Tkapp_MainLoop, METH_VARARGS},
1989+
{"dooneevent", Tkapp_DoOneEvent, METH_VARARGS},
1990+
{"quit", Tkapp_Quit, METH_VARARGS},
19911991
{NULL, NULL}
19921992
};
19931993

Modules/audioop.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,29 +1343,29 @@ audioop_adpcm2lin(PyObject *self, PyObject *args)
13431343
}
13441344

13451345
static PyMethodDef audioop_methods[] = {
1346-
{ "max", audioop_max },
1347-
{ "minmax", audioop_minmax },
1348-
{ "avg", audioop_avg },
1349-
{ "maxpp", audioop_maxpp },
1350-
{ "avgpp", audioop_avgpp },
1351-
{ "rms", audioop_rms },
1352-
{ "findfit", audioop_findfit },
1353-
{ "findmax", audioop_findmax },
1354-
{ "findfactor", audioop_findfactor },
1355-
{ "cross", audioop_cross },
1356-
{ "mul", audioop_mul },
1357-
{ "add", audioop_add },
1358-
{ "bias", audioop_bias },
1359-
{ "ulaw2lin", audioop_ulaw2lin },
1360-
{ "lin2ulaw", audioop_lin2ulaw },
1361-
{ "lin2lin", audioop_lin2lin },
1362-
{ "adpcm2lin", audioop_adpcm2lin },
1363-
{ "lin2adpcm", audioop_lin2adpcm },
1364-
{ "tomono", audioop_tomono },
1365-
{ "tostereo", audioop_tostereo },
1366-
{ "getsample", audioop_getsample },
1367-
{ "reverse", audioop_reverse },
1368-
{ "ratecv", audioop_ratecv, 1 },
1346+
{ "max", audioop_max, METH_OLDARGS },
1347+
{ "minmax", audioop_minmax, METH_OLDARGS },
1348+
{ "avg", audioop_avg, METH_OLDARGS },
1349+
{ "maxpp", audioop_maxpp, METH_OLDARGS },
1350+
{ "avgpp", audioop_avgpp, METH_OLDARGS },
1351+
{ "rms", audioop_rms, METH_OLDARGS },
1352+
{ "findfit", audioop_findfit, METH_OLDARGS },
1353+
{ "findmax", audioop_findmax, METH_OLDARGS },
1354+
{ "findfactor", audioop_findfactor, METH_OLDARGS },
1355+
{ "cross", audioop_cross, METH_OLDARGS },
1356+
{ "mul", audioop_mul, METH_OLDARGS },
1357+
{ "add", audioop_add, METH_OLDARGS },
1358+
{ "bias", audioop_bias, METH_OLDARGS },
1359+
{ "ulaw2lin", audioop_ulaw2lin, METH_OLDARGS },
1360+
{ "lin2ulaw", audioop_lin2ulaw, METH_OLDARGS },
1361+
{ "lin2lin", audioop_lin2lin, METH_OLDARGS },
1362+
{ "adpcm2lin", audioop_adpcm2lin, METH_OLDARGS },
1363+
{ "lin2adpcm", audioop_lin2adpcm, METH_OLDARGS },
1364+
{ "tomono", audioop_tomono, METH_OLDARGS },
1365+
{ "tostereo", audioop_tostereo, METH_OLDARGS },
1366+
{ "getsample", audioop_getsample, METH_OLDARGS },
1367+
{ "reverse", audioop_reverse, METH_OLDARGS },
1368+
{ "ratecv", audioop_ratecv, METH_VARARGS },
13691369
{ 0, 0 }
13701370
};
13711371

Modules/bsddbmodule.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -652,15 +652,15 @@ bsddb_sync(bsddbobject *dp, PyObject *args)
652652
return PyInt_FromLong(status = 0);
653653
}
654654
static PyMethodDef bsddb_methods[] = {
655-
{"close", (PyCFunction)bsddb_close},
656-
{"keys", (PyCFunction)bsddb_keys},
657-
{"has_key", (PyCFunction)bsddb_has_key},
658-
{"set_location", (PyCFunction)bsddb_set_location},
659-
{"next", (PyCFunction)bsddb_next},
660-
{"previous", (PyCFunction)bsddb_previous},
661-
{"first", (PyCFunction)bsddb_first},
662-
{"last", (PyCFunction)bsddb_last},
663-
{"sync", (PyCFunction)bsddb_sync},
655+
{"close", (PyCFunction)bsddb_close, METH_OLDARGS},
656+
{"keys", (PyCFunction)bsddb_keys, METH_OLDARGS},
657+
{"has_key", (PyCFunction)bsddb_has_key, METH_OLDARGS},
658+
{"set_location", (PyCFunction)bsddb_set_location, METH_OLDARGS},
659+
{"next", (PyCFunction)bsddb_next, METH_OLDARGS},
660+
{"previous", (PyCFunction)bsddb_previous, METH_OLDARGS},
661+
{"first", (PyCFunction)bsddb_first, METH_OLDARGS},
662+
{"last", (PyCFunction)bsddb_last, METH_OLDARGS},
663+
{"sync", (PyCFunction)bsddb_sync, METH_OLDARGS},
664664
{NULL, NULL} /* sentinel */
665665
};
666666

@@ -849,9 +849,9 @@ bsdrnopen(PyObject *self, PyObject *args)
849849
}
850850

851851
static PyMethodDef bsddbmodule_methods[] = {
852-
{"hashopen", (PyCFunction)bsdhashopen, 1},
853-
{"btopen", (PyCFunction)bsdbtopen, 1},
854-
{"rnopen", (PyCFunction)bsdrnopen, 1},
852+
{"hashopen", (PyCFunction)bsdhashopen, METH_VARARGS},
853+
{"btopen", (PyCFunction)bsdbtopen, METH_VARARGS},
854+
{"rnopen", (PyCFunction)bsdrnopen, METH_VARARGS},
855855
{0, 0},
856856
};
857857

Modules/cdmodule.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -353,24 +353,24 @@ CD_togglepause(cdplayerobject *self, PyObject *args)
353353
}
354354

355355
static PyMethodDef cdplayer_methods[] = {
356-
{"allowremoval", (PyCFunction)CD_allowremoval, 1},
357-
{"bestreadsize", (PyCFunction)CD_bestreadsize, 1},
358-
{"close", (PyCFunction)CD_close, 1},
359-
{"eject", (PyCFunction)CD_eject, 1},
360-
{"getstatus", (PyCFunction)CD_getstatus, 1},
361-
{"gettrackinfo", (PyCFunction)CD_gettrackinfo, 1},
362-
{"msftoblock", (PyCFunction)CD_msftoblock, 1},
363-
{"play", (PyCFunction)CD_play, 1},
364-
{"playabs", (PyCFunction)CD_playabs, 1},
365-
{"playtrack", (PyCFunction)CD_playtrack, 1},
366-
{"playtrackabs", (PyCFunction)CD_playtrackabs, 1},
367-
{"preventremoval", (PyCFunction)CD_preventremoval, 1},
368-
{"readda", (PyCFunction)CD_readda, 1},
369-
{"seek", (PyCFunction)CD_seek, 1},
370-
{"seekblock", (PyCFunction)CD_seekblock, 1},
371-
{"seektrack", (PyCFunction)CD_seektrack, 1},
372-
{"stop", (PyCFunction)CD_stop, 1},
373-
{"togglepause", (PyCFunction)CD_togglepause, 1},
356+
{"allowremoval", (PyCFunction)CD_allowremoval, METH_VARARGS},
357+
{"bestreadsize", (PyCFunction)CD_bestreadsize, METH_VARARGS},
358+
{"close", (PyCFunction)CD_close, METH_VARARGS},
359+
{"eject", (PyCFunction)CD_eject, METH_VARARGS},
360+
{"getstatus", (PyCFunction)CD_getstatus, METH_VARARGS},
361+
{"gettrackinfo", (PyCFunction)CD_gettrackinfo, METH_VARARGS},
362+
{"msftoblock", (PyCFunction)CD_msftoblock, METH_VARARGS},
363+
{"play", (PyCFunction)CD_play, METH_VARARGS},
364+
{"playabs", (PyCFunction)CD_playabs, METH_VARARGS},
365+
{"playtrack", (PyCFunction)CD_playtrack, METH_VARARGS},
366+
{"playtrackabs", (PyCFunction)CD_playtrackabs, METH_VARARGS},
367+
{"preventremoval", (PyCFunction)CD_preventremoval, METH_VARARGS},
368+
{"readda", (PyCFunction)CD_readda, METH_VARARGS},
369+
{"seek", (PyCFunction)CD_seek, METH_VARARGS},
370+
{"seekblock", (PyCFunction)CD_seekblock, METH_VARARGS},
371+
{"seektrack", (PyCFunction)CD_seektrack, METH_VARARGS},
372+
{"stop", (PyCFunction)CD_stop, METH_VARARGS},
373+
{"togglepause", (PyCFunction)CD_togglepause, METH_VARARGS},
374374
{NULL, NULL} /* sentinel */
375375
};
376376

@@ -653,13 +653,13 @@ CD_addcallback(cdparserobject *self, PyObject *args)
653653
}
654654

655655
static PyMethodDef cdparser_methods[] = {
656-
{"addcallback", (PyCFunction)CD_addcallback, 1},
657-
{"deleteparser", (PyCFunction)CD_deleteparser, 1},
658-
{"parseframe", (PyCFunction)CD_parseframe, 1},
659-
{"removecallback", (PyCFunction)CD_removecallback, 1},
660-
{"resetparser", (PyCFunction)CD_resetparser, 1},
656+
{"addcallback", (PyCFunction)CD_addcallback, METH_VARARGS},
657+
{"deleteparser", (PyCFunction)CD_deleteparser, METH_VARARGS},
658+
{"parseframe", (PyCFunction)CD_parseframe, METH_VARARGS},
659+
{"removecallback", (PyCFunction)CD_removecallback, METH_VARARGS},
660+
{"resetparser", (PyCFunction)CD_resetparser, METH_VARARGS},
661661
/* backward compatibility */
662-
{"setcallback", (PyCFunction)CD_addcallback, 1},
662+
{"setcallback", (PyCFunction)CD_addcallback, METH_VARARGS},
663663
{NULL, NULL} /* sentinel */
664664
};
665665

@@ -749,9 +749,9 @@ CD_msftoframe(PyObject *self, PyObject *args)
749749
}
750750

751751
static PyMethodDef CD_methods[] = {
752-
{"open", (PyCFunction)CD_open, 1},
753-
{"createparser", (PyCFunction)CD_createparser, 1},
754-
{"msftoframe", (PyCFunction)CD_msftoframe, 1},
752+
{"open", (PyCFunction)CD_open, METH_VARARGS},
753+
{"createparser", (PyCFunction)CD_createparser, METH_VARARGS},
754+
{"msftoframe", (PyCFunction)CD_msftoframe, METH_VARARGS},
755755
{NULL, NULL} /* Sentinel */
756756
};
757757

0 commit comments

Comments
 (0)