summaryrefslogtreecommitdiffstats
path: root/Modules/regexmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-08-13 22:34:14 (GMT)
committerGuido van Rossum <guido@python.org>1997-08-13 22:34:14 (GMT)
commit95e8053a9ff42a544197e562fdf4c462fc34e8b4 (patch)
tree06a4d3c599317f90f7a73027b1648bece2a059b2 /Modules/regexmodule.c
parenta74ef66ac82edd5a587606daef57ff6c26279280 (diff)
downloadcpython-95e8053a9ff42a544197e562fdf4c462fc34e8b4.zip
cpython-95e8053a9ff42a544197e562fdf4c462fc34e8b4.tar.gz
cpython-95e8053a9ff42a544197e562fdf4c462fc34e8b4.tar.bz2
1.5a3 prerelease 1 from AMK
Diffstat (limited to 'Modules/regexmodule.c')
-rw-r--r--Modules/regexmodule.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Modules/regexmodule.c b/Modules/regexmodule.c
index ad86068..32360f2 100644
--- a/Modules/regexmodule.c
+++ b/Modules/regexmodule.c
@@ -132,8 +132,10 @@ regobj_match(re, args)
re->re_lastok = NULL;
result = re_match(&re->re_patbuf, buffer, size, offset, &re->re_regs);
if (result < -1) {
- /* Failure like stack overflow */
- PyErr_SetString(RegexError, "match failure");
+ /* Serious failure of some sort; if re_match didn't
+ set an exception, raise a generic error */
+ if (!PyErr_Occurred())
+ PyErr_SetString(RegexError, "match failure");
return NULL;
}
if (result >= 0) {
@@ -174,8 +176,10 @@ regobj_search(re, args)
result = re_search(&re->re_patbuf, buffer, size, offset, range,
&re->re_regs);
if (result < -1) {
- /* Failure like stack overflow */
- PyErr_SetString(RegexError, "match failure");
+ /* Serious failure of some sort; if re_match didn't
+ set an exception, raise a generic error */
+ if (!PyErr_Occurred())
+ PyErr_SetString(RegexError, "match failure");
return NULL;
}
if (result >= 0) {