Use METH_VARARGS instead of numeric constant 1 in method def. tables

This commit is contained in:
Andrew M. Kuchling 2000-08-03 02:06:16 +00:00
parent 14f515844d
commit e365fb8d1f
12 changed files with 178 additions and 107 deletions

View File

@ -389,10 +389,14 @@ PyLocale_getdefaultlocale(PyObject* self, PyObject* args)
#endif #endif
static struct PyMethodDef PyLocale_Methods[] = { static struct PyMethodDef PyLocale_Methods[] = {
{"setlocale", (PyCFunction) PyLocale_setlocale, 1, setlocale__doc__}, {"setlocale", (PyCFunction) PyLocale_setlocale,
{"localeconv", (PyCFunction) PyLocale_localeconv, 0, localeconv__doc__}, METH_VARARGS, setlocale__doc__},
{"strcoll", (PyCFunction) PyLocale_strcoll, 1, strcoll__doc__}, {"localeconv", (PyCFunction) PyLocale_localeconv,
{"strxfrm", (PyCFunction) PyLocale_strxfrm, 1, strxfrm__doc__}, 0, localeconv__doc__},
{"strcoll", (PyCFunction) PyLocale_strcoll,
METH_VARARGS, strcoll__doc__},
{"strxfrm", (PyCFunction) PyLocale_strxfrm,
METH_VARARGS, strxfrm__doc__},
#if defined(MS_WIN32) || defined(macintosh) #if defined(MS_WIN32) || defined(macintosh)
{"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, 0}, {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, 0},
#endif #endif

View File

@ -877,20 +877,27 @@ binascii_crc32(PyObject *self, PyObject *args)
/* List of functions defined in the module */ /* List of functions defined in the module */
static struct PyMethodDef binascii_module_methods[] = { static struct PyMethodDef binascii_module_methods[] = {
{"a2b_uu", binascii_a2b_uu, 1, doc_a2b_uu}, {"a2b_uu", binascii_a2b_uu,
{"b2a_uu", binascii_b2a_uu, 1, doc_b2a_uu}, METH_VARARGS, doc_a2b_uu},
{"a2b_base64", binascii_a2b_base64, 1, {"b2a_uu", binascii_b2a_uu,
METH_VARARGS, doc_b2a_uu},
{"a2b_base64", binascii_a2b_base64,
METH_VARARGS,
doc_a2b_base64}, doc_a2b_base64},
{"b2a_base64", binascii_b2a_base64, 1, {"b2a_base64", binascii_b2a_base64,
doc_b2a_base64}, METH_VARARGS, doc_b2a_base64},
{"a2b_hqx", binascii_a2b_hqx, 1, doc_a2b_hqx}, {"a2b_hqx", binascii_a2b_hqx,
{"b2a_hqx", binascii_b2a_hqx, 1, doc_b2a_hqx}, METH_VARARGS, doc_a2b_hqx},
{"rlecode_hqx", binascii_rlecode_hqx, 1, {"b2a_hqx", binascii_b2a_hqx,
doc_rlecode_hqx}, METH_VARARGS, doc_b2a_hqx},
{"rledecode_hqx", binascii_rledecode_hqx, 1, {"rlecode_hqx", binascii_rlecode_hqx,
doc_rledecode_hqx}, METH_VARARGS, doc_rlecode_hqx},
{"crc_hqx", binascii_crc_hqx, 1, doc_crc_hqx}, {"rledecode_hqx", binascii_rledecode_hqx,
{"crc32", binascii_crc32, 1, doc_crc32}, METH_VARARGS, doc_rledecode_hqx},
{"crc_hqx", binascii_crc_hqx,
METH_VARARGS, doc_crc_hqx},
{"crc32", binascii_crc32,
METH_VARARGS, doc_crc32},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };

View File

@ -617,7 +617,8 @@ IO_StringIO(PyObject *self, PyObject *args) {
/* List of methods defined in the module */ /* List of methods defined in the module */
static struct PyMethodDef IO_methods[] = { static struct PyMethodDef IO_methods[] = {
{"StringIO", (PyCFunction)IO_StringIO, 1, IO_StringIO__doc__}, {"StringIO", (PyCFunction)IO_StringIO,
METH_VARARGS, IO_StringIO__doc__},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };

View File

@ -372,22 +372,38 @@ functions for complex numbers.";
static PyMethodDef cmath_methods[] = { static PyMethodDef cmath_methods[] = {
{"acos", cmath_acos, 1, c_acos_doc}, {"acos", cmath_acos,
{"acosh", cmath_acosh, 1, c_acosh_doc}, METH_VARARGS, c_acos_doc},
{"asin", cmath_asin, 1, c_asin_doc}, {"acosh", cmath_acosh,
{"asinh", cmath_asinh, 1, c_asinh_doc}, METH_VARARGS, c_acosh_doc},
{"atan", cmath_atan, 1, c_atan_doc}, {"asin", cmath_asin,
{"atanh", cmath_atanh, 1, c_atanh_doc}, METH_VARARGS, c_asin_doc},
{"cos", cmath_cos, 1, c_cos_doc}, {"asinh", cmath_asinh,
{"cosh", cmath_cosh, 1, c_cosh_doc}, METH_VARARGS, c_asinh_doc},
{"exp", cmath_exp, 1, c_exp_doc}, {"atan", cmath_atan,
{"log", cmath_log, 1, c_log_doc}, METH_VARARGS, c_atan_doc},
{"log10", cmath_log10, 1, c_log10_doc}, {"atanh", cmath_atanh,
{"sin", cmath_sin, 1, c_sin_doc}, METH_VARARGS, c_atanh_doc},
{"sinh", cmath_sinh, 1, c_sinh_doc}, {"cos", cmath_cos,
{"sqrt", cmath_sqrt, 1, c_sqrt_doc}, METH_VARARGS, c_cos_doc},
{"tan", cmath_tan, 1, c_tan_doc}, {"cosh", cmath_cosh,
{"tanh", cmath_tanh, 1, c_tanh_doc}, METH_VARARGS, c_cosh_doc},
{"exp", cmath_exp,
METH_VARARGS, c_exp_doc},
{"log", cmath_log,
METH_VARARGS, c_log_doc},
{"log10", cmath_log10,
METH_VARARGS, c_log10_doc},
{"sin", cmath_sin,
METH_VARARGS, c_sin_doc},
{"sinh", cmath_sinh,
METH_VARARGS, c_sinh_doc},
{"sqrt", cmath_sqrt,
METH_VARARGS, c_sqrt_doc},
{"tan", cmath_tan,
METH_VARARGS, c_tan_doc},
{"tanh", cmath_tanh,
METH_VARARGS, c_tanh_doc},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };

View File

@ -227,8 +227,8 @@ is made.";
/* List of functions exported by this module */ /* List of functions exported by this module */
static PyMethodDef md5_functions[] = { static PyMethodDef md5_functions[] = {
{"new", (PyCFunction)MD5_new, 1, new_doc}, {"new", (PyCFunction)MD5_new, METH_VARARGS, new_doc},
{"md5", (PyCFunction)MD5_new, 1, new_doc}, /* Backward compatibility */ {"md5", (PyCFunction)MD5_new, METH_VARARGS, new_doc}, /* Backward compatibility */
{NULL, NULL} /* Sentinel */ {NULL, NULL} /* Sentinel */
}; };

View File

@ -180,12 +180,18 @@ new_class(PyObject* unused, PyObject* args)
} }
static PyMethodDef new_methods[] = { static PyMethodDef new_methods[] = {
{"instance", new_instance, 1, new_instance_doc}, {"instance", new_instance,
{"instancemethod", new_instancemethod, 1, new_im_doc}, METH_VARARGS, new_instance_doc},
{"function", new_function, 1, new_function_doc}, {"instancemethod", new_instancemethod,
{"code", new_code, 1, new_code_doc}, METH_VARARGS, new_im_doc},
{"module", new_module, 1, new_module_doc}, {"function", new_function,
{"classobj", new_class, 1, new_class_doc}, METH_VARARGS, new_function_doc},
{"code", new_code,
METH_VARARGS, new_code_doc},
{"module", new_module,
METH_VARARGS, new_module_doc},
{"classobj", new_class,
METH_VARARGS, new_class_doc},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };

View File

@ -323,15 +323,19 @@ Insert text into the command line.\
static struct PyMethodDef readline_methods[] = static struct PyMethodDef readline_methods[] =
{ {
{"parse_and_bind", parse_and_bind, 1, doc_parse_and_bind}, {"parse_and_bind", parse_and_bind, METH_VARARGS, doc_parse_and_bind},
{"get_line_buffer", get_line_buffer, 0, doc_get_line_buffer}, {"get_line_buffer", get_line_buffer, 0, doc_get_line_buffer},
{"insert_text", insert_text, 1, doc_insert_text}, {"insert_text", insert_text, METH_VARARGS, doc_insert_text},
{"read_init_file", read_init_file, 1, doc_read_init_file}, {"read_init_file", read_init_file, METH_VARARGS, doc_read_init_file},
{"read_history_file", read_history_file, 1, doc_read_history_file}, {"read_history_file", read_history_file,
{"write_history_file", write_history_file, 1, doc_write_history_file}, METH_VARARGS, doc_read_history_file},
{"set_history_length", set_history_length, 1, set_history_length_doc}, {"write_history_file", write_history_file,
{"get_history_length", get_history_length, 1, get_history_length_doc}, METH_VARARGS, doc_write_history_file},
{"set_completer", set_completer, 1, doc_set_completer}, {"set_history_length", set_history_length,
METH_VARARGS, set_history_length_doc},
{"get_history_length", get_history_length,
METH_VARARGS, get_history_length_doc},
{"set_completer", set_completer, METH_VARARGS, doc_set_completer},
{"get_begidx", get_begidx, 0, doc_get_begidx}, {"get_begidx", get_begidx, 0, doc_get_begidx},
{"get_endidx", get_endidx, 0, doc_get_endidx}, {"get_endidx", get_endidx, 0, doc_get_endidx},

View File

@ -1344,49 +1344,49 @@ of the socket (flag == 1), or both ends (flag == 2).";
/* List of methods for socket objects */ /* List of methods for socket objects */
static PyMethodDef PySocketSock_methods[] = { static PyMethodDef PySocketSock_methods[] = {
{"accept", (PyCFunction)PySocketSock_accept, 1, {"accept", (PyCFunction)PySocketSock_accept, METH_VARARGS,
accept_doc}, accept_doc},
{"bind", (PyCFunction)PySocketSock_bind, 1, {"bind", (PyCFunction)PySocketSock_bind, METH_VARARGS,
bind_doc}, bind_doc},
{"close", (PyCFunction)PySocketSock_close, 1, {"close", (PyCFunction)PySocketSock_close, METH_VARARGS,
close_doc}, close_doc},
{"connect", (PyCFunction)PySocketSock_connect, 1, {"connect", (PyCFunction)PySocketSock_connect, METH_VARARGS,
connect_doc}, connect_doc},
{"connect_ex", (PyCFunction)PySocketSock_connect_ex, 1, {"connect_ex", (PyCFunction)PySocketSock_connect_ex, METH_VARARGS,
connect_ex_doc}, connect_ex_doc},
#ifndef NO_DUP #ifndef NO_DUP
{"dup", (PyCFunction)PySocketSock_dup, 1, {"dup", (PyCFunction)PySocketSock_dup, METH_VARARGS,
dup_doc}, dup_doc},
#endif #endif
{"fileno", (PyCFunction)PySocketSock_fileno, 1, {"fileno", (PyCFunction)PySocketSock_fileno, METH_VARARGS,
fileno_doc}, fileno_doc},
#ifdef HAVE_GETPEERNAME #ifdef HAVE_GETPEERNAME
{"getpeername", (PyCFunction)PySocketSock_getpeername, 1, {"getpeername", (PyCFunction)PySocketSock_getpeername, METH_VARARGS,
getpeername_doc}, getpeername_doc},
#endif #endif
{"getsockname", (PyCFunction)PySocketSock_getsockname, 1, {"getsockname", (PyCFunction)PySocketSock_getsockname, METH_VARARGS,
getsockname_doc}, getsockname_doc},
{"getsockopt", (PyCFunction)PySocketSock_getsockopt, 1, {"getsockopt", (PyCFunction)PySocketSock_getsockopt, METH_VARARGS,
getsockopt_doc}, getsockopt_doc},
{"listen", (PyCFunction)PySocketSock_listen, 1, {"listen", (PyCFunction)PySocketSock_listen, METH_VARARGS,
listen_doc}, listen_doc},
#ifndef NO_DUP #ifndef NO_DUP
{"makefile", (PyCFunction)PySocketSock_makefile, 1, {"makefile", (PyCFunction)PySocketSock_makefile, METH_VARARGS,
makefile_doc}, makefile_doc},
#endif #endif
{"recv", (PyCFunction)PySocketSock_recv, 1, {"recv", (PyCFunction)PySocketSock_recv, METH_VARARGS,
recv_doc}, recv_doc},
{"recvfrom", (PyCFunction)PySocketSock_recvfrom, 1, {"recvfrom", (PyCFunction)PySocketSock_recvfrom, METH_VARARGS,
recvfrom_doc}, recvfrom_doc},
{"send", (PyCFunction)PySocketSock_send, 1, {"send", (PyCFunction)PySocketSock_send, METH_VARARGS,
send_doc}, send_doc},
{"sendto", (PyCFunction)PySocketSock_sendto, 1, {"sendto", (PyCFunction)PySocketSock_sendto, METH_VARARGS,
sendto_doc}, sendto_doc},
{"setblocking", (PyCFunction)PySocketSock_setblocking, 1, {"setblocking", (PyCFunction)PySocketSock_setblocking, METH_VARARGS,
setblocking_doc}, setblocking_doc},
{"setsockopt", (PyCFunction)PySocketSock_setsockopt, 1, {"setsockopt", (PyCFunction)PySocketSock_setsockopt, METH_VARARGS,
setsockopt_doc}, setsockopt_doc},
{"shutdown", (PyCFunction)PySocketSock_shutdown, 1, {"shutdown", (PyCFunction)PySocketSock_shutdown, METH_VARARGS,
shutdown_doc}, shutdown_doc},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };
@ -2199,24 +2199,39 @@ static PyObject *SSL_SSLread(SSLObject *self, PyObject *args)
/* List of functions exported by this module. */ /* List of functions exported by this module. */
static PyMethodDef PySocket_methods[] = { static PyMethodDef PySocket_methods[] = {
{"gethostbyname", PySocket_gethostbyname, 1, gethostbyname_doc}, {"gethostbyname", PySocket_gethostbyname,
{"gethostbyname_ex", PySocket_gethostbyname_ex, 1, ghbn_ex_doc}, METH_VARARGS, gethostbyname_doc},
{"gethostbyaddr", PySocket_gethostbyaddr, 1, gethostbyaddr_doc}, {"gethostbyname_ex", PySocket_gethostbyname_ex,
{"gethostname", PySocket_gethostname, 1, gethostname_doc}, METH_VARARGS, ghbn_ex_doc},
{"getservbyname", PySocket_getservbyname, 1, getservbyname_doc}, {"gethostbyaddr", PySocket_gethostbyaddr,
{"getprotobyname", PySocket_getprotobyname, 1,getprotobyname_doc}, METH_VARARGS, gethostbyaddr_doc},
{"socket", PySocket_socket, 1, socket_doc}, {"gethostname", PySocket_gethostname,
METH_VARARGS, gethostname_doc},
{"getservbyname", PySocket_getservbyname,
METH_VARARGS, getservbyname_doc},
{"getprotobyname", PySocket_getprotobyname,
METH_VARARGS,getprotobyname_doc},
{"socket", PySocket_socket,
METH_VARARGS, socket_doc},
#ifndef NO_DUP #ifndef NO_DUP
{"fromfd", PySocket_fromfd, 1, fromfd_doc}, {"fromfd", PySocket_fromfd,
METH_VARARGS, fromfd_doc},
#endif #endif
{"ntohs", PySocket_ntohs, 1, ntohs_doc}, {"ntohs", PySocket_ntohs,
{"ntohl", PySocket_ntohl, 1, ntohl_doc}, METH_VARARGS, ntohs_doc},
{"htons", PySocket_htons, 1, htons_doc}, {"ntohl", PySocket_ntohl,
{"htonl", PySocket_htonl, 1, htonl_doc}, METH_VARARGS, ntohl_doc},
{"inet_aton", PySocket_inet_aton, 1, inet_aton_doc}, {"htons", PySocket_htons,
{"inet_ntoa", PySocket_inet_ntoa, 1, inet_ntoa_doc}, METH_VARARGS, htons_doc},
{"htonl", PySocket_htonl,
METH_VARARGS, htonl_doc},
{"inet_aton", PySocket_inet_aton,
METH_VARARGS, inet_aton_doc},
{"inet_ntoa", PySocket_inet_ntoa,
METH_VARARGS, inet_ntoa_doc},
#ifdef USE_SSL #ifdef USE_SSL
{"ssl", PySocket_ssl, 1, ssl_doc}, {"ssl", PySocket_ssl,
METH_VARARGS, ssl_doc},
#endif /* USE_SSL */ #endif /* USE_SSL */
{NULL, NULL} /* Sentinel */ {NULL, NULL} /* Sentinel */
}; };

View File

@ -157,10 +157,12 @@ sound_similar(PyObject *self, PyObject *args)
*/ */
static PyMethodDef SoundexMethods[] = static PyMethodDef SoundexMethods[] =
{ {
{"sound_similar", sound_similar, 1, soundex_sound_similar__doc__}, {"sound_similar", sound_similar,
{"get_soundex", get_soundex, 1, soundex_get_soundex__doc__}, METH_VARARGS, soundex_sound_similar__doc__},
{"get_soundex", get_soundex,
METH_VARARGS, soundex_get_soundex__doc__},
{NULL, NULL } /* sentinel */ {NULL, NULL } /* sentinel */
}; };

View File

@ -1154,26 +1154,40 @@ strop_replace(PyObject *self, PyObject *args)
static PyMethodDef static PyMethodDef
strop_methods[] = { strop_methods[] = {
{"atof", strop_atof, 1, atof__doc__}, {"atof", strop_atof,
{"atoi", strop_atoi, 1, atoi__doc__}, METH_VARARGS, atof__doc__},
{"atol", strop_atol, 1, atol__doc__}, {"atoi", strop_atoi,
METH_VARARGS, atoi__doc__},
{"atol", strop_atol,
METH_VARARGS, atol__doc__},
{"capitalize", strop_capitalize, 0, capitalize__doc__}, {"capitalize", strop_capitalize, 0, capitalize__doc__},
{"count", strop_count, 1, count__doc__}, {"count", strop_count,
{"expandtabs", strop_expandtabs, 1, expandtabs__doc__}, METH_VARARGS, count__doc__},
{"find", strop_find, 1, find__doc__}, {"expandtabs", strop_expandtabs,
{"join", strop_joinfields, 1, joinfields__doc__}, METH_VARARGS, expandtabs__doc__},
{"joinfields", strop_joinfields, 1, joinfields__doc__}, {"find", strop_find,
METH_VARARGS, find__doc__},
{"join", strop_joinfields,
METH_VARARGS, joinfields__doc__},
{"joinfields", strop_joinfields,
METH_VARARGS, joinfields__doc__},
{"lstrip", strop_lstrip, 0, lstrip__doc__}, {"lstrip", strop_lstrip, 0, lstrip__doc__},
{"lower", strop_lower, 0, lower__doc__}, {"lower", strop_lower, 0, lower__doc__},
{"maketrans", strop_maketrans, 1, maketrans__doc__}, {"maketrans", strop_maketrans,
{"replace", strop_replace, 1, replace__doc__}, METH_VARARGS, maketrans__doc__},
{"rfind", strop_rfind, 1, rfind__doc__}, {"replace", strop_replace,
METH_VARARGS, replace__doc__},
{"rfind", strop_rfind,
METH_VARARGS, rfind__doc__},
{"rstrip", strop_rstrip, 0, rstrip__doc__}, {"rstrip", strop_rstrip, 0, rstrip__doc__},
{"split", strop_splitfields, 1, splitfields__doc__}, {"split", strop_splitfields,
{"splitfields", strop_splitfields, 1, splitfields__doc__}, METH_VARARGS, splitfields__doc__},
{"splitfields", strop_splitfields,
METH_VARARGS, splitfields__doc__},
{"strip", strop_strip, 0, strip__doc__}, {"strip", strop_strip, 0, strip__doc__},
{"swapcase", strop_swapcase, 0, swapcase__doc__}, {"swapcase", strop_swapcase, 0, swapcase__doc__},
{"translate", strop_translate, 1, translate__doc__}, {"translate", strop_translate,
METH_VARARGS, translate__doc__},
{"upper", strop_upper, 0, upper__doc__}, {"upper", strop_upper, 0, upper__doc__},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };

View File

@ -337,9 +337,11 @@ be relied upon, and the number should be seen purely as a magic cookie.\n\
A thread's identity may be reused for another thread after it exits."; A thread's identity may be reused for another thread after it exits.";
static PyMethodDef thread_methods[] = { static PyMethodDef thread_methods[] = {
{"start_new_thread", (PyCFunction)thread_PyThread_start_new_thread, 1, {"start_new_thread", (PyCFunction)thread_PyThread_start_new_thread,
METH_VARARGS,
start_new_doc}, start_new_doc},
{"start_new", (PyCFunction)thread_PyThread_start_new_thread, 1, {"start_new", (PyCFunction)thread_PyThread_start_new_thread,
METH_VARARGS,
start_new_doc}, start_new_doc},
{"allocate_lock", (PyCFunction)thread_PyThread_allocate_lock, 0, {"allocate_lock", (PyCFunction)thread_PyThread_allocate_lock, 0,
allocate_doc}, allocate_doc},

View File

@ -498,16 +498,16 @@ static PyMethodDef time_methods[] = {
{"sleep", time_sleep, 0, sleep_doc}, {"sleep", time_sleep, 0, sleep_doc},
{"gmtime", time_gmtime, 0, gmtime_doc}, {"gmtime", time_gmtime, 0, gmtime_doc},
{"localtime", time_localtime, 0, localtime_doc}, {"localtime", time_localtime, 0, localtime_doc},
{"asctime", time_asctime, 1, asctime_doc}, {"asctime", time_asctime, METH_VARARGS, asctime_doc},
{"ctime", time_ctime, 0, ctime_doc}, {"ctime", time_ctime, 0, ctime_doc},
#ifdef HAVE_MKTIME #ifdef HAVE_MKTIME
{"mktime", time_mktime, 1, mktime_doc}, {"mktime", time_mktime, METH_VARARGS, mktime_doc},
#endif #endif
#ifdef HAVE_STRFTIME #ifdef HAVE_STRFTIME
{"strftime", time_strftime, 1, strftime_doc}, {"strftime", time_strftime, METH_VARARGS, strftime_doc},
#endif #endif
#ifdef HAVE_STRPTIME #ifdef HAVE_STRPTIME
{"strptime", time_strptime, 1, strptime_doc}, {"strptime", time_strptime, METH_VARARGS, strptime_doc},
#endif #endif
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };