Commit 1a785530 authored by Guido van Rossum's avatar Guido van Rossum

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.
parent 0e5ab17a
...@@ -512,6 +512,10 @@ PyPcre_expand(self, args) ...@@ -512,6 +512,10 @@ PyPcre_expand(self, args)
{ {
PyObject *r, *tuple, *result; PyObject *r, *tuple, *result;
r=PyObject_GetAttrString(match_obj, "group"); r=PyObject_GetAttrString(match_obj, "group");
if (r == NULL) {
Py_DECREF(results);
return NULL;
}
tuple=PyTuple_New(1); tuple=PyTuple_New(1);
Py_INCREF(value); Py_INCREF(value);
PyTuple_SetItem(tuple, 0, value); PyTuple_SetItem(tuple, 0, value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment