From 591c906121dbfc4f479ac521bf2cd90cbccea360 Mon Sep 17 00:00:00 2001 From: Fantix King Date: Wed, 1 Feb 2023 13:57:46 -0500 Subject: [PATCH] Fix wrong codecs API use Fixes #18 --- codecs/text.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codecs/text.pyx b/codecs/text.pyx index 17b5d25..79f375d 100644 --- a/codecs/text.pyx +++ b/codecs/text.pyx @@ -14,7 +14,7 @@ cdef inline as_pg_string_and_size( if settings.is_encoding_utf8(): cstr[0] = 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: @@ -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):