Issue 1242657: list(obj) can swallow KeyboardInterrupt
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 56071a0..34d9137 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -2679,6 +2679,10 @@
 
     /* Try to determine the length of the argument. 32 is abitrary. */
     buf_size = _PyObject_LengthHint(arg, 32);
+	if (buf_size == -1) {
+		Py_DECREF(it);
+		return NULL;
+	}
 
     bytes_obj = PyByteArray_FromStringAndSize(NULL, buf_size);
     if (bytes_obj == NULL)