@@ -173,8 +173,8 @@ def float8_recv(data: bytes, offset: int, length: int) -> float:
173173 return d_unpack (data , offset )[0 ]
174174
175175
176- # def bytea_send (v: bytearray) -> bytearray :
177- # return v
176+ def varbyte_send (v : bytearray ) -> bytes :
177+ return v . hex (). encode ( _client_encoding )
178178
179179
180180# def uuid_send(v: UUID) -> bytes:
@@ -576,8 +576,8 @@ def geometryhex_recv(data: bytes, idx: int, length: int) -> str:
576576 return result .hex ()
577577
578578
579- def varbytehex_recv (data : bytes , idx : int , length : int ) -> bytes :
580- return codecs_decode (data [idx : idx + length ], "hex_codec" )
579+ def varbytehex_recv (data : bytes , idx : int , length : int ) -> str :
580+ return codecs_decode (data [idx : idx + length ], "hex_codec" ). decode ( _client_encoding )
581581
582582
583583# def inet_in(data: bytes, offset: int, length: int) -> typing.Union[IPv4Address, IPv6Address, IPv4Network, IPv6Network]:
@@ -696,7 +696,7 @@ def numeric_out(d: Decimal) -> bytes:
696696 Decimal : (NUMERIC , FC_TEXT , numeric_out ), # Decimal
697697 PGTsvector : (3614 , FC_TEXT , text_out ),
698698 # UUID: (2950, FC_BINARY, uuid_send), # uuid
699- # bytes: (17, FC_BINARY, bytea_send ), # bytea
699+ bytes : (UNKNOWN , FC_TEXT , varbyte_send ), # varbyte
700700 str : (UNKNOWN , FC_TEXT , text_out ), # unknown
701701 enum .Enum : (UNKNOWN , FC_TEXT , enum_out ),
702702 # IPv4Address: (869, FC_TEXT, inet_out), # inet
0 commit comments