1.5a3 prerelease 1 from AMK

This commit is contained in:
Guido van Rossum 1997-08-13 22:34:14 +00:00
parent a74ef66ac8
commit 95e8053a9f
8 changed files with 226 additions and 114 deletions

View file

@ -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) {