commit | b516370bcbeef7391edc28fa6bfcc8da6d98beea | [log] [tgz] |
---|---|---|
author | Raymond Hettinger <python@rcn.com> | Mon Feb 02 21:50:13 2009 +0000 |
committer | Raymond Hettinger <python@rcn.com> | Mon Feb 02 21:50:13 2009 +0000 |
tree | 057c3efe6e2de33086e1762a5a17d68384368eb0 | |
parent | d7bb4d484ff0adb0f40e34ed316e58e8a4b88a9e [diff] [blame] |
Issue 1242657: list(obj) can swallow KeyboardInterrupt.
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 4b8d585..4cfd9f8 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c
@@ -2691,6 +2691,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)