Marc-Andre Lemburg added the comment: The patch looks fine to me, but I still wonder how p - PyBytes_AS_STRING(v) can be negative when size == 0...
Ah, now I get it: the new size is 0, but the refcount is not 1, since the nullstring is shared. This causes the exception. >From _PyBytes_Resize(): if (!PyBytes_Check(v) || Py_REFCNT(v) != 1 || newsize < 0) { *pv = 0; Py_DECREF(v); PyErr_BadInternalCall(); return -1; } ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25270> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com