diff options
| author | Raymond Hettinger <python@rcn.com> | 2009-02-02 22:44:06 (GMT) |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2009-02-02 22:44:06 (GMT) |
| commit | 24e2872f0d04c0d7c1745f677aef1a335433b556 (patch) | |
| tree | d11c883d601cda87a46839fbc6ba321089c6cb61 /Objects/bytearrayobject.c | |
| parent | b2dbd4309aa3d2a8a823d251447b8fd8b4b2d7e3 (diff) | |
| download | cpython-24e2872f0d04c0d7c1745f677aef1a335433b556.zip cpython-24e2872f0d04c0d7c1745f677aef1a335433b556.tar.gz cpython-24e2872f0d04c0d7c1745f677aef1a335433b556.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 56071a0..34d9137 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -2679,6 +2679,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) |
