Using the default ._cmsgpack implementation of an Unpacker, you will get the wrong answer if you call tell() after read_bytes(). Here's a simple repro:
import msgpack
from io import BytesIO
buf = BytesIO(b'my data')
u = msgpack.Unpacker(buf)
print(u.tell())
u.read_bytes(5)
print(u.tell())
After calling u.read_bytes(5), u.tell() will still return 0. It looks like the stream_offset in _unpacker.pyx should be advanced in read_bytes(), but is currently only advanced by _unpack().
Note that this works correctly in the .fallback implementation, so a quick workaround is to use import msgpack.fallback as msgpack, but I assume this is much slower than the C implementation.
Using the default
._cmsgpackimplementation of anUnpacker, you will get the wrong answer if you calltell()afterread_bytes(). Here's a simple repro:After calling
u.read_bytes(5),u.tell()will still return 0. It looks like thestream_offsetin_unpacker.pyxshould be advanced inread_bytes(), but is currently only advanced by_unpack().Note that this works correctly in the
.fallbackimplementation, so a quick workaround is to useimport msgpack.fallback as msgpack, but I assume this is much slower than the C implementation.