diff Modules/regexmodule.c @ 22709:3aa4bf7ac31e legacy-trunk

Remove METH_OLDARGS: Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple Convert METH_OLDARGS -> METH_NOARGS: remove args parameter Please review. All tests pass, but some modules don't have tests. I spot checked various functions to try to make sure nothing broke.
author Neal Norwitz <nnorwitz@gmail.com>
date Sun, 31 Mar 2002 15:27:00 +0000
parents 40631ae74b17
children 6fa76b4e59fe
line wrap: on
line diff
--- a/Modules/regexmodule.c	Sun Mar 31 14:57:24 2002 +0000
+++ b/Modules/regexmodule.c	Sun Mar 31 15:27:00 2002 +0000
@@ -583,7 +583,7 @@
 	PyObject *pat, *string;
 	PyObject *tuple, *v;
 
-	if (!PyArg_Parse(args, "(SS)", &pat, &string))
+	if (!PyArg_ParseTuple(args, "SS:match", &pat, &string))
 		return NULL;
 	if (update_cache(pat) < 0)
 		return NULL;
@@ -601,7 +601,7 @@
 	PyObject *pat, *string;
 	PyObject *tuple, *v;
 
-	if (!PyArg_Parse(args, "(SS)", &pat, &string))
+	if (!PyArg_ParseTuple(args, "SS:search", &pat, &string))
 		return NULL;
 	if (update_cache(pat) < 0)
 		return NULL;
@@ -617,7 +617,7 @@
 regex_set_syntax(PyObject *self, PyObject *args)
 {
 	int syntax;
-	if (!PyArg_Parse(args, "i", &syntax))
+	if (!PyArg_ParseTuple(args, "i:set_syntax", &syntax))
 		return NULL;
 	syntax = re_set_syntax(syntax);
 	/* wipe the global pattern cache */
@@ -629,10 +629,8 @@
 }
 
 static PyObject *
-regex_get_syntax(PyObject *self, PyObject *args)
+regex_get_syntax(PyObject *self)
 {
-	if (!PyArg_Parse(args, ""))
-		return NULL;
 	return PyInt_FromLong((long)re_syntax);
 }
 
@@ -640,10 +638,10 @@
 static struct PyMethodDef regex_global_methods[] = {
 	{"compile",	regex_compile, METH_VARARGS},
 	{"symcomp",	regex_symcomp, METH_VARARGS},
-	{"match",	regex_match, METH_OLDARGS},
-	{"search",	regex_search, METH_OLDARGS},
-	{"set_syntax",	regex_set_syntax, METH_OLDARGS},
-	{"get_syntax",  regex_get_syntax, METH_OLDARGS},
+	{"match",	regex_match, METH_VARARGS},
+	{"search",	regex_search, METH_VARARGS},
+	{"set_syntax",	regex_set_syntax, METH_VARARGS},
+	{"get_syntax",  (PyCFunction)regex_get_syntax, METH_NOARGS},
 	{NULL,		NULL}		     /* sentinel */
 };