Skip to content

Wrong number of items in using codecs API #19

Closed
@fantix

Description

@fantix

The codecs.Codec.decode() and encode() APIs return a tuple, while the current code is assuming its first item:

encoded = settings.get_text_codec().encode(obj)
cpython.PyBytes_AsStringAndSize(encoded, cstr, size)

bytes = cpython.PyBytes_FromStringAndSize(data, len)
return settings.get_text_codec().decode(bytes)

This leads to issues in asyncpg when client_encoding is not UTF-8 - all text results are tuples, while text arguments fail to be encoded with errors.

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