mirror of
https://github.com/python/cpython
synced 2026-09-29 09:40:29 +03:00
Some robustness checks in Py_ReprLeave() in the unlikely event someone
has messed with the dictionary or list.
This commit is contained in:
parent
8f6b958fdb
commit
eb90946978
1 changed files with 4 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue