diff options
author | Guido van Rossum <guido@python.org> | 1997-08-13 22:34:14 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-08-13 22:34:14 (GMT) |
commit | 95e8053a9ff42a544197e562fdf4c462fc34e8b4 (patch) | |
tree | 06a4d3c599317f90f7a73027b1648bece2a059b2 /Modules/regexmodule.c | |
parent | a74ef66ac82edd5a587606daef57ff6c26279280 (diff) | |
download | cpython-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.c | 12 |
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) { |