diff options
author | Raymond Hettinger <python@rcn.com> | 2009-02-02 22:55:09 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-02-02 22:55:09 (GMT) |
commit | e8364233aea88cf68e8f54a515dce10160ead35b (patch) | |
tree | bbe6369d9536d20602676c097b8c60ce8fa325a0 /Objects/bytearrayobject.c | |
parent | 9f9892648f954e45a628113febb524261075db32 (diff) | |
download | cpython-e8364233aea88cf68e8f54a515dce10160ead35b.zip cpython-e8364233aea88cf68e8f54a515dce10160ead35b.tar.gz cpython-e8364233aea88cf68e8f54a515dce10160ead35b.tar.bz2 |
Issue 1242657: list(obj) can swallow KeyboardInterrupt.
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r-- | Objects/bytearrayobject.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 9e93dda..868013a 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -2616,6 +2616,10 @@ bytes_extend(PyByteArrayObject *self, PyObject *arg) /* 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) |