Skip to content

Commit 952de28

Browse files
author
akuchling
committed
Use METH_OLDARGS instead of numeric constant 0 in method def. tables
git-svn-id: http://svn.python.org/projects/python/trunk@16594 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 6146dcb commit 952de28

9 files changed

Lines changed: 78 additions & 55 deletions

File tree

Modules/cryptmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ the same alphabet as the salt.";
3131

3232

3333
static PyMethodDef crypt_methods[] = {
34-
{"crypt", crypt_crypt, 0, crypt_crypt__doc__},
34+
{"crypt", crypt_crypt, METH_OLDARGS, crypt_crypt__doc__},
3535
{NULL, NULL} /* sentinel */
3636
};
3737

Modules/md5module.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,12 @@ Return a copy (``clone'') of the md5 object.";
126126

127127

128128
static PyMethodDef md5_methods[] = {
129-
{"update", (PyCFunction)md5_update, 0, update_doc},
130-
{"digest", (PyCFunction)md5_digest, 0, digest_doc},
131-
{"copy", (PyCFunction)md5_copy, 0, copy_doc},
129+
{"update", (PyCFunction)md5_update,
130+
METH_OLDARGS, update_doc},
131+
{"digest", (PyCFunction)md5_digest,
132+
METH_OLDARGS, digest_doc},
133+
{"copy", (PyCFunction)md5_copy,
134+
METH_OLDARGS, copy_doc},
132135
{NULL, NULL} /* sentinel */
133136
};
134137

Modules/pwdmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ pwd_getpwall(PyObject *self, PyObject *args)
128128
#endif
129129

130130
static PyMethodDef pwd_methods[] = {
131-
{"getpwuid", pwd_getpwuid, 0, pwd_getpwuid__doc__},
132-
{"getpwnam", pwd_getpwnam, 0, pwd_getpwnam__doc__},
131+
{"getpwuid", pwd_getpwuid, METH_OLDARGS, pwd_getpwuid__doc__},
132+
{"getpwnam", pwd_getpwnam, METH_OLDARGS, pwd_getpwnam__doc__},
133133
#ifdef HAVE_GETPWENT
134-
{"getpwall", pwd_getpwall, 0, pwd_getpwall__doc__},
134+
{"getpwall", pwd_getpwall, METH_OLDARGS, pwd_getpwall__doc__},
135135
#endif
136136
{NULL, NULL} /* sentinel */
137137
};

Modules/readline.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,8 @@ Insert text into the command line.\
324324
static struct PyMethodDef readline_methods[] =
325325
{
326326
{"parse_and_bind", parse_and_bind, METH_VARARGS, doc_parse_and_bind},
327-
{"get_line_buffer", get_line_buffer, 0, doc_get_line_buffer},
327+
{"get_line_buffer", get_line_buffer,
328+
METH_OLDARGS, doc_get_line_buffer},
328329
{"insert_text", insert_text, METH_VARARGS, doc_insert_text},
329330
{"read_init_file", read_init_file, METH_VARARGS, doc_read_init_file},
330331
{"read_history_file", read_history_file,
@@ -336,13 +337,13 @@ static struct PyMethodDef readline_methods[] =
336337
{"get_history_length", get_history_length,
337338
METH_VARARGS, get_history_length_doc},
338339
{"set_completer", set_completer, METH_VARARGS, doc_set_completer},
339-
{"get_begidx", get_begidx, 0, doc_get_begidx},
340-
{"get_endidx", get_endidx, 0, doc_get_endidx},
340+
{"get_begidx", get_begidx, METH_OLDARGS, doc_get_begidx},
341+
{"get_endidx", get_endidx, METH_OLDARGS, doc_get_endidx},
341342

342-
{"set_completer_delims", set_completer_delims, METH_VARARGS,
343-
doc_set_completer_delims},
344-
{"get_completer_delims", get_completer_delims, 0,
345-
doc_get_completer_delims},
343+
{"set_completer_delims", set_completer_delims,
344+
METH_VARARGS, doc_set_completer_delims},
345+
{"get_completer_delims", get_completer_delims,
346+
METH_OLDARGS, doc_get_completer_delims},
346347
{0, 0}
347348
};
348349

Modules/signalmodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,15 @@ anything else -- the callable Python object used as a handler\n\
280280
/* List of functions defined in the module */
281281
static PyMethodDef signal_methods[] = {
282282
#ifdef HAVE_ALARM
283-
{"alarm", signal_alarm, 0, alarm_doc},
283+
{"alarm", signal_alarm, METH_OLDARGS, alarm_doc},
284284
#endif
285-
{"signal", signal_signal, 0, signal_doc},
286-
{"getsignal", signal_getsignal, 0, getsignal_doc},
285+
{"signal", signal_signal, METH_OLDARGS, signal_doc},
286+
{"getsignal", signal_getsignal, METH_OLDARGS, getsignal_doc},
287287
#ifdef HAVE_PAUSE
288-
{"pause", signal_pause, 0, pause_doc},
288+
{"pause", signal_pause, METH_OLDARGS, pause_doc},
289289
#endif
290-
{"default_int_handler", signal_default_int_handler, 0,
291-
default_int_handler_doc},
290+
{"default_int_handler", signal_default_int_handler,
291+
METH_OLDARGS, default_int_handler_doc},
292292
{NULL, NULL} /* sentinel */
293293
};
294294

Modules/stropmodule.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,8 @@ strop_methods[] = {
11601160
METH_VARARGS, atoi__doc__},
11611161
{"atol", strop_atol,
11621162
METH_VARARGS, atol__doc__},
1163-
{"capitalize", strop_capitalize, 0, capitalize__doc__},
1163+
{"capitalize", strop_capitalize,
1164+
METH_OLDARGS, capitalize__doc__},
11641165
{"count", strop_count,
11651166
METH_VARARGS, count__doc__},
11661167
{"expandtabs", strop_expandtabs,
@@ -1171,24 +1172,30 @@ strop_methods[] = {
11711172
METH_VARARGS, joinfields__doc__},
11721173
{"joinfields", strop_joinfields,
11731174
METH_VARARGS, joinfields__doc__},
1174-
{"lstrip", strop_lstrip, 0, lstrip__doc__},
1175-
{"lower", strop_lower, 0, lower__doc__},
1175+
{"lstrip", strop_lstrip,
1176+
METH_OLDARGS, lstrip__doc__},
1177+
{"lower", strop_lower,
1178+
METH_OLDARGS, lower__doc__},
11761179
{"maketrans", strop_maketrans,
11771180
METH_VARARGS, maketrans__doc__},
11781181
{"replace", strop_replace,
11791182
METH_VARARGS, replace__doc__},
11801183
{"rfind", strop_rfind,
11811184
METH_VARARGS, rfind__doc__},
1182-
{"rstrip", strop_rstrip, 0, rstrip__doc__},
1185+
{"rstrip", strop_rstrip,
1186+
METH_OLDARGS, rstrip__doc__},
11831187
{"split", strop_splitfields,
11841188
METH_VARARGS, splitfields__doc__},
11851189
{"splitfields", strop_splitfields,
11861190
METH_VARARGS, splitfields__doc__},
1187-
{"strip", strop_strip, 0, strip__doc__},
1188-
{"swapcase", strop_swapcase, 0, swapcase__doc__},
1191+
{"strip", strop_strip,
1192+
METH_OLDARGS, strip__doc__},
1193+
{"swapcase", strop_swapcase,
1194+
METH_OLDARGS, swapcase__doc__},
11891195
{"translate", strop_translate,
11901196
METH_VARARGS, translate__doc__},
1191-
{"upper", strop_upper, 0, upper__doc__},
1197+
{"upper", strop_upper,
1198+
METH_OLDARGS, upper__doc__},
11921199
{NULL, NULL} /* sentinel */
11931200
};
11941201

Modules/termios.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,18 @@ termios_tcflow(PyObject *self, PyObject *args)
278278

279279
static PyMethodDef termios_methods[] =
280280
{
281-
{"tcgetattr", termios_tcgetattr, 0, termios_tcgetattr__doc__},
282-
{"tcsetattr", termios_tcsetattr, 0, termios_tcsetattr__doc__},
283-
{"tcsendbreak", termios_tcsendbreak, 0, termios_tcsendbreak__doc__},
284-
{"tcdrain", termios_tcdrain, 0, termios_tcdrain__doc__},
285-
{"tcflush", termios_tcflush, 0, termios_tcflush__doc__},
286-
{"tcflow", termios_tcflow, 0, termios_tcflow__doc__},
281+
{"tcgetattr", termios_tcgetattr,
282+
METH_OLDARGS, termios_tcgetattr__doc__},
283+
{"tcsetattr", termios_tcsetattr,
284+
METH_OLDARGS, termios_tcsetattr__doc__},
285+
{"tcsendbreak", termios_tcsendbreak,
286+
METH_OLDARGS, termios_tcsendbreak__doc__},
287+
{"tcdrain", termios_tcdrain,
288+
METH_OLDARGS, termios_tcdrain__doc__},
289+
{"tcflush", termios_tcflush,
290+
METH_OLDARGS, termios_tcflush__doc__},
291+
{"tcflow", termios_tcflow,
292+
METH_OLDARGS, termios_tcflow__doc__},
287293
{NULL, NULL}
288294
};
289295

Modules/threadmodule.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,18 @@ static char locked_doc[] =
141141
Return whether the lock is in the locked state.";
142142

143143
static PyMethodDef lock_methods[] = {
144-
{"acquire_lock", (PyCFunction)lock_PyThread_acquire_lock, 0, acquire_doc},
145-
{"acquire", (PyCFunction)lock_PyThread_acquire_lock, 0, acquire_doc},
146-
{"release_lock", (PyCFunction)lock_PyThread_release_lock, 0, release_doc},
147-
{"release", (PyCFunction)lock_PyThread_release_lock, 0, release_doc},
148-
{"locked_lock", (PyCFunction)lock_locked_lock, 0, locked_doc},
149-
{"locked", (PyCFunction)lock_locked_lock, 0, locked_doc},
144+
{"acquire_lock", (PyCFunction)lock_PyThread_acquire_lock,
145+
METH_OLDARGS, acquire_doc},
146+
{"acquire", (PyCFunction)lock_PyThread_acquire_lock,
147+
METH_OLDARGS, acquire_doc},
148+
{"release_lock", (PyCFunction)lock_PyThread_release_lock,
149+
METH_OLDARGS, release_doc},
150+
{"release", (PyCFunction)lock_PyThread_release_lock,
151+
METH_OLDARGS, release_doc},
152+
{"locked_lock", (PyCFunction)lock_locked_lock,
153+
METH_OLDARGS, locked_doc},
154+
{"locked", (PyCFunction)lock_locked_lock,
155+
METH_OLDARGS, locked_doc},
150156
{NULL, NULL} /* sentinel */
151157
};
152158

@@ -343,16 +349,16 @@ static PyMethodDef thread_methods[] = {
343349
{"start_new", (PyCFunction)thread_PyThread_start_new_thread,
344350
METH_VARARGS,
345351
start_new_doc},
346-
{"allocate_lock", (PyCFunction)thread_PyThread_allocate_lock, 0,
347-
allocate_doc},
348-
{"allocate", (PyCFunction)thread_PyThread_allocate_lock, 0,
349-
allocate_doc},
350-
{"exit_thread", (PyCFunction)thread_PyThread_exit_thread, 0,
351-
exit_doc},
352-
{"exit", (PyCFunction)thread_PyThread_exit_thread, 0,
353-
exit_doc},
354-
{"get_ident", (PyCFunction)thread_get_ident, 0,
355-
get_ident_doc},
352+
{"allocate_lock", (PyCFunction)thread_PyThread_allocate_lock,
353+
METH_OLDARGS, allocate_doc},
354+
{"allocate", (PyCFunction)thread_PyThread_allocate_lock,
355+
METH_OLDARGS, allocate_doc},
356+
{"exit_thread", (PyCFunction)thread_PyThread_exit_thread,
357+
METH_OLDARGS, exit_doc},
358+
{"exit", (PyCFunction)thread_PyThread_exit_thread,
359+
METH_OLDARGS, exit_doc},
360+
{"get_ident", (PyCFunction)thread_get_ident,
361+
METH_OLDARGS, get_ident_doc},
356362
#ifndef NO_EXIT_PROG
357363
{"exit_prog", (PyCFunction)thread_PyThread_exit_prog},
358364
#endif

Modules/timemodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -491,15 +491,15 @@ Convert a time tuple in local time to seconds since the Epoch.";
491491
#endif /* HAVE_MKTIME */
492492

493493
static PyMethodDef time_methods[] = {
494-
{"time", time_time, 0, time_doc},
494+
{"time", time_time, METH_OLDARGS, time_doc},
495495
#ifdef HAVE_CLOCK
496-
{"clock", time_clock, 0, clock_doc},
496+
{"clock", time_clock, METH_OLDARGS, clock_doc},
497497
#endif
498-
{"sleep", time_sleep, 0, sleep_doc},
499-
{"gmtime", time_gmtime, 0, gmtime_doc},
500-
{"localtime", time_localtime, 0, localtime_doc},
498+
{"sleep", time_sleep, METH_OLDARGS, sleep_doc},
499+
{"gmtime", time_gmtime, METH_OLDARGS, gmtime_doc},
500+
{"localtime", time_localtime, METH_OLDARGS, localtime_doc},
501501
{"asctime", time_asctime, METH_VARARGS, asctime_doc},
502-
{"ctime", time_ctime, 0, ctime_doc},
502+
{"ctime", time_ctime, METH_OLDARGS, ctime_doc},
503503
#ifdef HAVE_MKTIME
504504
{"mktime", time_mktime, METH_VARARGS, mktime_doc},
505505
#endif

0 commit comments

Comments
 (0)