summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-01-01 14:52:16 (GMT)
committerGuido van Rossum <guido@python.org>1992-01-01 14:52:16 (GMT)
commitb824fc67736107a76feb436891909bee06fefe78 (patch)
treee9f18aa02fdb510b57d83273c90298f3f65ebff2
parent09cea47433c4bc8e556589ba9a7ee0d773d8b2a8 (diff)
downloadcpython-b824fc67736107a76feb436891909bee06fefe78.zip
cpython-b824fc67736107a76feb436891909bee06fefe78.tar.gz
cpython-b824fc67736107a76feb436891909bee06fefe78.tar.bz2
'regs' is a read-only data member, not a function.
-rw-r--r--Modules/regexmodule.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/Modules/regexmodule.c b/Modules/regexmodule.c
index 5e82832..fade99f 100644
--- a/Modules/regexmodule.c
+++ b/Modules/regexmodule.c
@@ -146,23 +146,9 @@ reg_search(re, args)
return newintobject((long)result); /* Position of the match or -1 */
}
-static object *
-reg_regs(re, args)
- regexobject *re;
- object *args;
-{
- if (!re->re_regs_valid) {
- err_setstr(RegexError,
- "regs only valid after successful match/search");
- return NULL;
- }
- return makeresult(&re->re_regs);
-}
-
static struct methodlist reg_methods[] = {
{"match", reg_match},
{"search", reg_search},
- {"regs", reg_regs},
{NULL, NULL} /* sentinel */
};
@@ -171,6 +157,14 @@ reg_getattr(re, name)
regexobject *re;
char *name;
{
+ if (strcmp(name, "regs") == 0) {
+ if (!re->re_regs_valid) {
+ err_setstr(RegexError,
+ "regs only valid after successful match/search");
+ return NULL;
+ }
+ return makeresult(&re->re_regs);
+ }
return findmethod(reg_methods, (object *)re, name);
}