mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Fix a possible segfault from recursing too deep to get the repr of a list.
Closes issue #1096.
This commit is contained in:
parent
f3d280e62a
commit
a0c05512ec
3 changed files with 11 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue