Skip to content

Commit

Permalink
Fix wrong codecs API use
Browse files Browse the repository at this point in the history
Fixes #18
  • Loading branch information
fantix committed Feb 1, 2023
1 parent e7f1a02 commit 591c906
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions codecs/text.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cdef inline as_pg_string_and_size(
if settings.is_encoding_utf8():
cstr[0] = <char*>cpythonx.PyUnicode_AsUTF8AndSize(obj, size)
else:
encoded = settings.get_text_codec().encode(obj)
encoded = settings.get_text_codec().encode(obj)[0]
cpython.PyBytes_AsStringAndSize(encoded, cstr, size)

if size[0] > 0x7fffffff:
Expand All @@ -40,7 +40,7 @@ cdef inline decode_pg_string(CodecContext settings, const char* data,
return cpython.PyUnicode_DecodeUTF8(data, len, NULL)
else:
bytes = cpython.PyBytes_FromStringAndSize(data, len)
return settings.get_text_codec().decode(bytes)
return settings.get_text_codec().decode(bytes)[0]


cdef text_decode(CodecContext settings, FRBuffer *buf):
Expand Down

0 comments on commit 591c906

Please sign in to comment.