-
Notifications
You must be signed in to change notification settings - Fork 238
Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels