diff -r d9a3d23cf8f0 Objects/bytearrayobject.c --- a/Objects/bytearrayobject.c Tue Oct 14 00:53:13 2014 +0200 +++ b/Objects/bytearrayobject.c Tue Oct 14 18:26:40 2014 +0200 @@ -200,7 +200,7 @@ return -1; } - if (size + logical_offset + 1 < alloc) { + if (size < alloc && logical_offset + 1 < alloc - size) { /* Current buffer is large enough to host the requested size, decide on a strategy. */ if (size < alloc / 2) {