Some robustness checks in Py_ReprLeave() in the unlikely event someone

has messed with the dictionary or list.
This commit is contained in:
Guido van Rossum 1998-04-11 15:17:34 +00:00
parent 8f6b958fdb
commit eb90946978

View file

@ -844,7 +844,11 @@ Py_ReprLeave(obj)
int i;
dict = PyThreadState_GetDict();
if (dict == NULL)
return;
list = PyDict_GetItemString(dict, KEY);
if (list == NULL || !PyList_Check(list))
return;
i = PyList_GET_SIZE(list);
/* Count backwards because we always expect obj to be list[-1] */
while (--i >= 0) {