Fix a possible segfault from recursing too deep to get the repr of a list.

Closes issue #1096.
This commit is contained in:
Brett Cannon 2007-09-10 21:38:27 +00:00
parent f3d280e62a
commit a0c05512ec
3 changed files with 11 additions and 0 deletions

View file

@ -324,7 +324,10 @@ list_repr(PyListObject *v)
so must refetch the list size on each iteration. */
for (i = 0; i < Py_Size(v); ++i) {
int status;
if (Py_EnterRecursiveCall(" while getting the repr of a list"))
goto Done;
s = PyObject_Repr(v->ob_item[i]);
Py_LeaveRecursiveCall();
if (s == NULL)
goto Done;
status = PyList_Append(pieces, s);