Skip to content

Commit

Permalink
Patch #477750: Use METH_ constants in Modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
loewis committed Jan 17, 2002
1 parent c0e1671 commit 43b936d
Show file tree
Hide file tree
Showing 27 changed files with 449 additions and 449 deletions.
58 changes: 29 additions & 29 deletions Modules/_codecsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,37 +667,37 @@ mbcs_encode(PyObject *self,
/* --- Module API --------------------------------------------------------- */

static PyMethodDef _codecs_functions[] = {
{"register", codecregister, 1},
{"lookup", codeclookup, 1},
{"register", codecregister, METH_VARARGS},
{"lookup", codeclookup, METH_VARARGS},
#ifdef Py_USING_UNICODE
{"utf_8_encode", utf_8_encode, 1},
{"utf_8_decode", utf_8_decode, 1},
{"utf_7_encode", utf_7_encode, 1},
{"utf_7_decode", utf_7_decode, 1},
{"utf_16_encode", utf_16_encode, 1},
{"utf_16_le_encode", utf_16_le_encode, 1},
{"utf_16_be_encode", utf_16_be_encode, 1},
{"utf_16_decode", utf_16_decode, 1},
{"utf_16_le_decode", utf_16_le_decode, 1},
{"utf_16_be_decode", utf_16_be_decode, 1},
{"utf_16_ex_decode", utf_16_ex_decode, 1},
{"unicode_escape_encode", unicode_escape_encode, 1},
{"unicode_escape_decode", unicode_escape_decode, 1},
{"unicode_internal_encode", unicode_internal_encode, 1},
{"unicode_internal_decode", unicode_internal_decode, 1},
{"raw_unicode_escape_encode", raw_unicode_escape_encode, 1},
{"raw_unicode_escape_decode", raw_unicode_escape_decode, 1},
{"latin_1_encode", latin_1_encode, 1},
{"latin_1_decode", latin_1_decode, 1},
{"ascii_encode", ascii_encode, 1},
{"ascii_decode", ascii_decode, 1},
{"charmap_encode", charmap_encode, 1},
{"charmap_decode", charmap_decode, 1},
{"readbuffer_encode", readbuffer_encode, 1},
{"charbuffer_encode", charbuffer_encode, 1},
{"utf_8_encode", utf_8_encode, METH_VARARGS},
{"utf_8_decode", utf_8_decode, METH_VARARGS},
{"utf_7_encode", utf_7_encode, METH_VARARGS},
{"utf_7_decode", utf_7_decode, METH_VARARGS},
{"utf_16_encode", utf_16_encode, METH_VARARGS},
{"utf_16_le_encode", utf_16_le_encode, METH_VARARGS},
{"utf_16_be_encode", utf_16_be_encode, METH_VARARGS},
{"utf_16_decode", utf_16_decode, METH_VARARGS},
{"utf_16_le_decode", utf_16_le_decode, METH_VARARGS},
{"utf_16_be_decode", utf_16_be_decode, METH_VARARGS},
{"utf_16_ex_decode", utf_16_ex_decode, METH_VARARGS},
{"unicode_escape_encode", unicode_escape_encode, METH_VARARGS},
{"unicode_escape_decode", unicode_escape_decode, METH_VARARGS},
{"unicode_internal_encode", unicode_internal_encode, METH_VARARGS},
{"unicode_internal_decode", unicode_internal_decode, METH_VARARGS},
{"raw_unicode_escape_encode", raw_unicode_escape_encode, METH_VARARGS},
{"raw_unicode_escape_decode", raw_unicode_escape_decode, METH_VARARGS},
{"latin_1_encode", latin_1_encode, METH_VARARGS},
{"latin_1_decode", latin_1_decode, METH_VARARGS},
{"ascii_encode", ascii_encode, METH_VARARGS},
{"ascii_decode", ascii_decode, METH_VARARGS},
{"charmap_encode", charmap_encode, METH_VARARGS},
{"charmap_decode", charmap_decode, METH_VARARGS},
{"readbuffer_encode", readbuffer_encode, METH_VARARGS},
{"charbuffer_encode", charbuffer_encode, METH_VARARGS},
#if defined(MS_WIN32) && defined(HAVE_USABLE_WCHAR_T)
{"mbcs_encode", mbcs_encode, 1},
{"mbcs_decode", mbcs_decode, 1},
{"mbcs_encode", mbcs_encode, METH_VARARGS},
{"mbcs_decode", mbcs_decode, METH_VARARGS},
#endif
#endif /* Py_USING_UNICODE */
{NULL, NULL} /* sentinel */
Expand Down
80 changes: 40 additions & 40 deletions Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1763,40 +1763,40 @@ Tkapp_InterpAddr(PyObject *self, PyObject *args)

static PyMethodDef Tkapp_methods[] =
{
{"call", Tkapp_Call, 0},
{"globalcall", Tkapp_GlobalCall, 0},
{"eval", Tkapp_Eval, 1},
{"globaleval", Tkapp_GlobalEval, 1},
{"evalfile", Tkapp_EvalFile, 1},
{"record", Tkapp_Record, 1},
{"adderrorinfo", Tkapp_AddErrorInfo, 1},
{"setvar", Tkapp_SetVar, 1},
{"globalsetvar", Tkapp_GlobalSetVar, 1},
{"getvar", Tkapp_GetVar, 1},
{"globalgetvar", Tkapp_GlobalGetVar, 1},
{"unsetvar", Tkapp_UnsetVar, 1},
{"globalunsetvar", Tkapp_GlobalUnsetVar, 1},
{"getint", Tkapp_GetInt, 1},
{"getdouble", Tkapp_GetDouble, 1},
{"getboolean", Tkapp_GetBoolean, 1},
{"exprstring", Tkapp_ExprString, 1},
{"exprlong", Tkapp_ExprLong, 1},
{"exprdouble", Tkapp_ExprDouble, 1},
{"exprboolean", Tkapp_ExprBoolean, 1},
{"splitlist", Tkapp_SplitList, 1},
{"split", Tkapp_Split, 1},
{"merge", Tkapp_Merge, 0},
{"createcommand", Tkapp_CreateCommand, 1},
{"deletecommand", Tkapp_DeleteCommand, 1},
{"call", Tkapp_Call, METH_OLDARGS},
{"globalcall", Tkapp_GlobalCall, METH_OLDARGS},
{"eval", Tkapp_Eval, METH_VARARGS},
{"globaleval", Tkapp_GlobalEval, METH_VARARGS},
{"evalfile", Tkapp_EvalFile, METH_VARARGS},
{"record", Tkapp_Record, METH_VARARGS},
{"adderrorinfo", Tkapp_AddErrorInfo, METH_VARARGS},
{"setvar", Tkapp_SetVar, METH_VARARGS},
{"globalsetvar", Tkapp_GlobalSetVar, METH_VARARGS},
{"getvar", Tkapp_GetVar, METH_VARARGS},
{"globalgetvar", Tkapp_GlobalGetVar, METH_VARARGS},
{"unsetvar", Tkapp_UnsetVar, METH_VARARGS},
{"globalunsetvar", Tkapp_GlobalUnsetVar, METH_VARARGS},
{"getint", Tkapp_GetInt, METH_VARARGS},
{"getdouble", Tkapp_GetDouble, METH_VARARGS},
{"getboolean", Tkapp_GetBoolean, METH_VARARGS},
{"exprstring", Tkapp_ExprString, METH_VARARGS},
{"exprlong", Tkapp_ExprLong, METH_VARARGS},
{"exprdouble", Tkapp_ExprDouble, METH_VARARGS},
{"exprboolean", Tkapp_ExprBoolean, METH_VARARGS},
{"splitlist", Tkapp_SplitList, METH_VARARGS},
{"split", Tkapp_Split, METH_VARARGS},
{"merge", Tkapp_Merge, METH_OLDARGS},
{"createcommand", Tkapp_CreateCommand, METH_VARARGS},
{"deletecommand", Tkapp_DeleteCommand, METH_VARARGS},
#ifdef HAVE_CREATEFILEHANDLER
{"createfilehandler", Tkapp_CreateFileHandler, 1},
{"deletefilehandler", Tkapp_DeleteFileHandler, 1},
{"createfilehandler", Tkapp_CreateFileHandler, METH_VARARGS},
{"deletefilehandler", Tkapp_DeleteFileHandler, METH_VARARGS},
#endif
{"createtimerhandler", Tkapp_CreateTimerHandler, 1},
{"mainloop", Tkapp_MainLoop, 1},
{"dooneevent", Tkapp_DoOneEvent, 1},
{"quit", Tkapp_Quit, 1},
{"interpaddr", Tkapp_InterpAddr, 1},
{"createtimerhandler", Tkapp_CreateTimerHandler, METH_VARARGS},
{"mainloop", Tkapp_MainLoop, METH_VARARGS},
{"dooneevent", Tkapp_DoOneEvent, METH_VARARGS},
{"quit", Tkapp_Quit, METH_VARARGS},
{"interpaddr", Tkapp_InterpAddr, METH_VARARGS},
{NULL, NULL}
};

Expand Down Expand Up @@ -1978,16 +1978,16 @@ Tkinter_Create(PyObject *self, PyObject *args)

static PyMethodDef moduleMethods[] =
{
{"_flatten", Tkinter_Flatten, 1},
{"create", Tkinter_Create, 1},
{"_flatten", Tkinter_Flatten, METH_VARARGS},
{"create", Tkinter_Create, METH_VARARGS},
#ifdef HAVE_CREATEFILEHANDLER
{"createfilehandler", Tkapp_CreateFileHandler, 1},
{"deletefilehandler", Tkapp_DeleteFileHandler, 1},
{"createfilehandler", Tkapp_CreateFileHandler, METH_VARARGS},
{"deletefilehandler", Tkapp_DeleteFileHandler, METH_VARARGS},
#endif
{"createtimerhandler", Tkapp_CreateTimerHandler, 1},
{"mainloop", Tkapp_MainLoop, 1},
{"dooneevent", Tkapp_DoOneEvent, 1},
{"quit", Tkapp_Quit, 1},
{"createtimerhandler", Tkapp_CreateTimerHandler, METH_VARARGS},
{"mainloop", Tkapp_MainLoop, METH_VARARGS},
{"dooneevent", Tkapp_DoOneEvent, METH_VARARGS},
{"quit", Tkapp_Quit, METH_VARARGS},
{NULL, NULL}
};

Expand Down
46 changes: 23 additions & 23 deletions Modules/audioop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1343,29 +1343,29 @@ audioop_adpcm2lin(PyObject *self, PyObject *args)
}

static PyMethodDef audioop_methods[] = {
{ "max", audioop_max },
{ "minmax", audioop_minmax },
{ "avg", audioop_avg },
{ "maxpp", audioop_maxpp },
{ "avgpp", audioop_avgpp },
{ "rms", audioop_rms },
{ "findfit", audioop_findfit },
{ "findmax", audioop_findmax },
{ "findfactor", audioop_findfactor },
{ "cross", audioop_cross },
{ "mul", audioop_mul },
{ "add", audioop_add },
{ "bias", audioop_bias },
{ "ulaw2lin", audioop_ulaw2lin },
{ "lin2ulaw", audioop_lin2ulaw },
{ "lin2lin", audioop_lin2lin },
{ "adpcm2lin", audioop_adpcm2lin },
{ "lin2adpcm", audioop_lin2adpcm },
{ "tomono", audioop_tomono },
{ "tostereo", audioop_tostereo },
{ "getsample", audioop_getsample },
{ "reverse", audioop_reverse },
{ "ratecv", audioop_ratecv, 1 },
{ "max", audioop_max, METH_OLDARGS },
{ "minmax", audioop_minmax, METH_OLDARGS },
{ "avg", audioop_avg, METH_OLDARGS },
{ "maxpp", audioop_maxpp, METH_OLDARGS },
{ "avgpp", audioop_avgpp, METH_OLDARGS },
{ "rms", audioop_rms, METH_OLDARGS },
{ "findfit", audioop_findfit, METH_OLDARGS },
{ "findmax", audioop_findmax, METH_OLDARGS },
{ "findfactor", audioop_findfactor, METH_OLDARGS },
{ "cross", audioop_cross, METH_OLDARGS },
{ "mul", audioop_mul, METH_OLDARGS },
{ "add", audioop_add, METH_OLDARGS },
{ "bias", audioop_bias, METH_OLDARGS },
{ "ulaw2lin", audioop_ulaw2lin, METH_OLDARGS },
{ "lin2ulaw", audioop_lin2ulaw, METH_OLDARGS },
{ "lin2lin", audioop_lin2lin, METH_OLDARGS },
{ "adpcm2lin", audioop_adpcm2lin, METH_OLDARGS },
{ "lin2adpcm", audioop_lin2adpcm, METH_OLDARGS },
{ "tomono", audioop_tomono, METH_OLDARGS },
{ "tostereo", audioop_tostereo, METH_OLDARGS },
{ "getsample", audioop_getsample, METH_OLDARGS },
{ "reverse", audioop_reverse, METH_OLDARGS },
{ "ratecv", audioop_ratecv, METH_VARARGS },
{ 0, 0 }
};

Expand Down
24 changes: 12 additions & 12 deletions Modules/bsddbmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,15 +652,15 @@ bsddb_sync(bsddbobject *dp, PyObject *args)
return PyInt_FromLong(status = 0);
}
static PyMethodDef bsddb_methods[] = {
{"close", (PyCFunction)bsddb_close},
{"keys", (PyCFunction)bsddb_keys},
{"has_key", (PyCFunction)bsddb_has_key},
{"set_location", (PyCFunction)bsddb_set_location},
{"next", (PyCFunction)bsddb_next},
{"previous", (PyCFunction)bsddb_previous},
{"first", (PyCFunction)bsddb_first},
{"last", (PyCFunction)bsddb_last},
{"sync", (PyCFunction)bsddb_sync},
{"close", (PyCFunction)bsddb_close, METH_OLDARGS},
{"keys", (PyCFunction)bsddb_keys, METH_OLDARGS},
{"has_key", (PyCFunction)bsddb_has_key, METH_OLDARGS},
{"set_location", (PyCFunction)bsddb_set_location, METH_OLDARGS},
{"next", (PyCFunction)bsddb_next, METH_OLDARGS},
{"previous", (PyCFunction)bsddb_previous, METH_OLDARGS},
{"first", (PyCFunction)bsddb_first, METH_OLDARGS},
{"last", (PyCFunction)bsddb_last, METH_OLDARGS},
{"sync", (PyCFunction)bsddb_sync, METH_OLDARGS},
{NULL, NULL} /* sentinel */
};

Expand Down Expand Up @@ -849,9 +849,9 @@ bsdrnopen(PyObject *self, PyObject *args)
}

static PyMethodDef bsddbmodule_methods[] = {
{"hashopen", (PyCFunction)bsdhashopen, 1},
{"btopen", (PyCFunction)bsdbtopen, 1},
{"rnopen", (PyCFunction)bsdrnopen, 1},
{"hashopen", (PyCFunction)bsdhashopen, METH_VARARGS},
{"btopen", (PyCFunction)bsdbtopen, METH_VARARGS},
{"rnopen", (PyCFunction)bsdrnopen, METH_VARARGS},
{0, 0},
};

Expand Down
54 changes: 27 additions & 27 deletions Modules/cdmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,24 +353,24 @@ CD_togglepause(cdplayerobject *self, PyObject *args)
}

static PyMethodDef cdplayer_methods[] = {
{"allowremoval", (PyCFunction)CD_allowremoval, 1},
{"bestreadsize", (PyCFunction)CD_bestreadsize, 1},
{"close", (PyCFunction)CD_close, 1},
{"eject", (PyCFunction)CD_eject, 1},
{"getstatus", (PyCFunction)CD_getstatus, 1},
{"gettrackinfo", (PyCFunction)CD_gettrackinfo, 1},
{"msftoblock", (PyCFunction)CD_msftoblock, 1},
{"play", (PyCFunction)CD_play, 1},
{"playabs", (PyCFunction)CD_playabs, 1},
{"playtrack", (PyCFunction)CD_playtrack, 1},
{"playtrackabs", (PyCFunction)CD_playtrackabs, 1},
{"preventremoval", (PyCFunction)CD_preventremoval, 1},
{"readda", (PyCFunction)CD_readda, 1},
{"seek", (PyCFunction)CD_seek, 1},
{"seekblock", (PyCFunction)CD_seekblock, 1},
{"seektrack", (PyCFunction)CD_seektrack, 1},
{"stop", (PyCFunction)CD_stop, 1},
{"togglepause", (PyCFunction)CD_togglepause, 1},
{"allowremoval", (PyCFunction)CD_allowremoval, METH_VARARGS},
{"bestreadsize", (PyCFunction)CD_bestreadsize, METH_VARARGS},
{"close", (PyCFunction)CD_close, METH_VARARGS},
{"eject", (PyCFunction)CD_eject, METH_VARARGS},
{"getstatus", (PyCFunction)CD_getstatus, METH_VARARGS},
{"gettrackinfo", (PyCFunction)CD_gettrackinfo, METH_VARARGS},
{"msftoblock", (PyCFunction)CD_msftoblock, METH_VARARGS},
{"play", (PyCFunction)CD_play, METH_VARARGS},
{"playabs", (PyCFunction)CD_playabs, METH_VARARGS},
{"playtrack", (PyCFunction)CD_playtrack, METH_VARARGS},
{"playtrackabs", (PyCFunction)CD_playtrackabs, METH_VARARGS},
{"preventremoval", (PyCFunction)CD_preventremoval, METH_VARARGS},
{"readda", (PyCFunction)CD_readda, METH_VARARGS},
{"seek", (PyCFunction)CD_seek, METH_VARARGS},
{"seekblock", (PyCFunction)CD_seekblock, METH_VARARGS},
{"seektrack", (PyCFunction)CD_seektrack, METH_VARARGS},
{"stop", (PyCFunction)CD_stop, METH_VARARGS},
{"togglepause", (PyCFunction)CD_togglepause, METH_VARARGS},
{NULL, NULL} /* sentinel */
};

Expand Down Expand Up @@ -653,13 +653,13 @@ CD_addcallback(cdparserobject *self, PyObject *args)
}

static PyMethodDef cdparser_methods[] = {
{"addcallback", (PyCFunction)CD_addcallback, 1},
{"deleteparser", (PyCFunction)CD_deleteparser, 1},
{"parseframe", (PyCFunction)CD_parseframe, 1},
{"removecallback", (PyCFunction)CD_removecallback, 1},
{"resetparser", (PyCFunction)CD_resetparser, 1},
{"addcallback", (PyCFunction)CD_addcallback, METH_VARARGS},
{"deleteparser", (PyCFunction)CD_deleteparser, METH_VARARGS},
{"parseframe", (PyCFunction)CD_parseframe, METH_VARARGS},
{"removecallback", (PyCFunction)CD_removecallback, METH_VARARGS},
{"resetparser", (PyCFunction)CD_resetparser, METH_VARARGS},
/* backward compatibility */
{"setcallback", (PyCFunction)CD_addcallback, 1},
{"setcallback", (PyCFunction)CD_addcallback, METH_VARARGS},
{NULL, NULL} /* sentinel */
};

Expand Down Expand Up @@ -749,9 +749,9 @@ CD_msftoframe(PyObject *self, PyObject *args)
}

static PyMethodDef CD_methods[] = {
{"open", (PyCFunction)CD_open, 1},
{"createparser", (PyCFunction)CD_createparser, 1},
{"msftoframe", (PyCFunction)CD_msftoframe, 1},
{"open", (PyCFunction)CD_open, METH_VARARGS},
{"createparser", (PyCFunction)CD_createparser, METH_VARARGS},
{"msftoframe", (PyCFunction)CD_msftoframe, METH_VARARGS},
{NULL, NULL} /* Sentinel */
};

Expand Down
Loading

0 comments on commit 43b936d

Please sign in to comment.