diff Objects/listobject.c @ 51284:74438fc11d05 3.0

Issue 1242657: list(obj) can swallow KeyboardInterrupt.
author Raymond Hettinger <python@rcn.com>
date Mon, 02 Feb 2009 23:42:36 +0000
parents 87fbbf22adf3
children a0951f11be3d
line wrap: on
line diff
--- a/Objects/listobject.c	Mon Feb 02 21:37:16 2009 +0000
+++ b/Objects/listobject.c	Mon Feb 02 23:42:36 2009 +0000
@@ -802,6 +802,10 @@
 
 	/* Guess a result list size. */
 	n = _PyObject_LengthHint(b, 8);
+	if (n == -1) {
+		Py_DECREF(it);
+		return NULL;
+	}
 	m = Py_SIZE(self);
 	mn = m + n;
 	if (mn >= m) {