Add test for failure of the getattr call in pcre_expand() -- it used

to core dump if the first argument did not have a "group" attribute.
This commit is contained in:
Guido van Rossum 1998-07-17 20:19:48 +00:00
parent 0e5ab17ad3
commit 1a78553093
1 changed files with 4 additions and 0 deletions

View File

@ -512,6 +512,10 @@ PyPcre_expand(self, args)
{
PyObject *r, *tuple, *result;
r=PyObject_GetAttrString(match_obj, "group");
if (r == NULL) {
Py_DECREF(results);
return NULL;
}
tuple=PyTuple_New(1);
Py_INCREF(value);
PyTuple_SetItem(tuple, 0, value);