From eb909469787bda8eae147adc3e2b7049b73875d9 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sat, 11 Apr 1998 15:17:34 +0000 Subject: Some robustness checks in Py_ReprLeave() in the unlikely event someone has messed with the dictionary or list. --- Objects/object.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Objects/object.c b/Objects/object.c index f84e64f..1a1ed52 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) { -- cgit v0.12