Xiang Zhang <angwerzx at 126.com> added the comment: Why not just bytes(buf[:4]) before passing? ---------- nosy: +xiang.zhang _______________________________________ Python tracker <report at bugs.python.org> <https://bugs.python.org/issue34465> _______________________________________