static PyObject*pattern_scanner(PatternObject*, PyObject*);
static PyObject *
-sre_codesize(PyObject* self, PyObject* args)
+sre_codesize(PyObject* self)
{
return Py_BuildValue("i", sizeof(SRE_CODE));
}
}
static PyObject*
-pattern_copy(PatternObject* self, PyObject* args)
+pattern_copy(PatternObject* self)
{
#ifdef USE_BUILTIN_COPY
PatternObject* copy;
int offset;
- if (args != Py_None && !PyArg_ParseTuple(args, ":__copy__"))
- return NULL;
-
copy = PyObject_NEW_VAR(PatternObject, &Pattern_Type, self->codesize);
if (!copy)
return NULL;
}
static PyObject*
-pattern_deepcopy(PatternObject* self, PyObject* args)
+pattern_deepcopy(PatternObject* self, PyObject* memo)
{
#ifdef USE_BUILTIN_COPY
PatternObject* copy;
- PyObject* memo;
- if (!PyArg_ParseTuple(args, "O:__deepcopy__", &memo))
- return NULL;
-
- copy = (PatternObject*) pattern_copy(self, Py_None);
+ copy = (PatternObject*) pattern_copy(self);
if (!copy)
return NULL;
pattern_finditer_doc},
#endif
{"scanner", (PyCFunction) pattern_scanner, METH_VARARGS},
- {"__copy__", (PyCFunction) pattern_copy, METH_VARARGS},
- {"__deepcopy__", (PyCFunction) pattern_deepcopy, METH_VARARGS},
+ {"__copy__", (PyCFunction) pattern_copy, METH_NOARGS},
+ {"__deepcopy__", (PyCFunction) pattern_deepcopy, METH_O},
{NULL, NULL}
};
}
static PyObject*
-match_expand(MatchObject* self, PyObject* args)
+match_expand(MatchObject* self, PyObject* ptemplate)
{
- PyObject* ptemplate;
- if (!PyArg_ParseTuple(args, "O:expand", &ptemplate))
- return NULL;
-
/* delegate to Python code */
return call(
SRE_PY_MODULE, "_expand",
}
static PyObject*
-match_copy(MatchObject* self, PyObject* args)
+match_copy(MatchObject* self)
{
#ifdef USE_BUILTIN_COPY
MatchObject* copy;
int slots, offset;
- if (args != Py_None && !PyArg_ParseTuple(args, ":__copy__"))
- return NULL;
-
slots = 2 * (self->pattern->groups+1);
copy = PyObject_NEW_VAR(MatchObject, &Match_Type, slots);
}
static PyObject*
-match_deepcopy(MatchObject* self, PyObject* args)
+match_deepcopy(MatchObject* self, PyObject* memo)
{
#ifdef USE_BUILTIN_COPY
MatchObject* copy;
- PyObject* memo;
- if (!PyArg_ParseTuple(args, "O:__deepcopy__", &memo))
- return NULL;
-
- copy = (MatchObject*) match_copy(self, Py_None);
+ copy = (MatchObject*) match_copy(self);
if (!copy)
return NULL;
{"span", (PyCFunction) match_span, METH_VARARGS},
{"groups", (PyCFunction) match_groups, METH_VARARGS|METH_KEYWORDS},
{"groupdict", (PyCFunction) match_groupdict, METH_VARARGS|METH_KEYWORDS},
- {"expand", (PyCFunction) match_expand, METH_VARARGS},
- {"__copy__", (PyCFunction) match_copy, METH_VARARGS},
- {"__deepcopy__", (PyCFunction) match_deepcopy, METH_VARARGS},
+ {"expand", (PyCFunction) match_expand, METH_O},
+ {"__copy__", (PyCFunction) match_copy, METH_NOARGS},
+ {"__deepcopy__", (PyCFunction) match_deepcopy, METH_O},
{NULL, NULL}
};
}
static PyObject*
-scanner_match(ScannerObject* self, PyObject* args)
+scanner_match(ScannerObject* self)
{
SRE_STATE* state = &self->state;
PyObject* match;
static PyObject*
-scanner_search(ScannerObject* self, PyObject* args)
+scanner_search(ScannerObject* self)
{
SRE_STATE* state = &self->state;
PyObject* match;
}
static PyMethodDef scanner_methods[] = {
- /* FIXME: use METH_OLDARGS instead of 0 or fix to use METH_VARARGS */
- /* METH_OLDARGS is not in Python 1.5.2 */
- {"match", (PyCFunction) scanner_match, 0},
- {"search", (PyCFunction) scanner_search, 0},
+ {"match", (PyCFunction) scanner_match, METH_NOARGS},
+ {"search", (PyCFunction) scanner_search, METH_NOARGS},
{NULL, NULL}
};
static PyMethodDef _functions[] = {
{"compile", _compile, METH_VARARGS},
- {"getcodesize", sre_codesize, METH_VARARGS},
+ {"getcodesize", sre_codesize, METH_NOARGS},
{"getlower", sre_getlower, METH_VARARGS},
{NULL, NULL}
};