8000 Decoding empty string fails with encoding='u8' · Issue #234 · msgpack/msgpack-python · GitHub
[go: up one dir, main page]

Skip to content
< 84CD div class="Box-sc-g0xbh4-0 hzqxma primary-viewer" data-testid="issue-viewer-container">
Decoding empty string fails with encoding='u8' #234
Closed
@marningmol

Description

@marningmol

>>> msgpack.version
(0, 4, 8)

>>> msgpack.unpackb(msgpack.packb("foo", encoding='u8'), encoding='u8')
'foo'

>>> msgpack.unpackb(msgpack.packb("", encoding='u8'), encoding='u8')

msgpack/_unpacker.pyx in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:139)()
ValueError: PyMemoryView_FromBuffer(): info->buf must not be NULL

>>> msgpack.unpackb(msgpack.packb(""), encoding='u8')

msgpack/_unpacker.pyx in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:139)()
ValueError: PyMemoryView_FromBuffer(): info->buf must not be NULL

Basically you can't unpack b'\xa0' if you provide encoding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0