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 f84e64f..1a1ed52 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -844,7 +844,11 @@
 	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) {