From: Guido van Rossum Date: Sat, 11 Apr 1998 15:17:34 +0000 (+0000) Subject: Some robustness checks in Py_ReprLeave() in the unlikely event someone X-Git-Tag: v1.5.1~48 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb909469787bda8eae147adc3e2b7049b73875d9;p=python Some robustness checks in Py_ReprLeave() in the unlikely event someone has messed with the dictionary or list. --- diff --git a/Objects/object.c b/Objects/object.c index f84e64fa2c..1a1ed52208 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -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) {