summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-04-11 15:17:34 (GMT)
committerGuido van Rossum <guido@python.org>1998-04-11 15:17:34 (GMT)
commiteb909469787bda8eae147adc3e2b7049b73875d9 (patch)
tree4654dda91e259652c4dde291cb4209a9a43287b7
parent8f6b958fdbbd38be648b85a6754cfb065eb9677c (diff)
downloadcpython-eb909469787bda8eae147adc3e2b7049b73875d9.zip
cpython-eb909469787bda8eae147adc3e2b7049b73875d9.tar.gz
cpython-eb909469787bda8eae147adc3e2b7049b73875d9.tar.bz2
Some robustness checks in Py_ReprLeave() in the unlikely event someone
has messed with the dictionary or list.
-rw-r--r--Objects/object.c4
1 files changed, 4 insertions, 0 deletions
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) {