Skip to content

Commit ab0bc71

Browse files
committed
Fix bswap on *BSD
This is a regression of #313, since pgproto had picked up an unfixed version of hton.h Fixes: #396
1 parent 43a7b21 commit ab0bc71

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

asyncpg/protocol/coreproto.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ cdef class CoreProtocol:
398398
if cbuf != NULL and cbuf_len > 0:
399399
msg = cpython.PyBytes_FromStringAndSize(cbuf, cbuf_len - 1)
400400
else:
401-
msg = self.buffer.read_cstr()
401+
msg = self.buffer.read_null_str()
402402
self.result_status_msg = msg
403403

404404
cdef _parse_copy_data_msgs(self):
@@ -510,18 +510,18 @@ cdef class CoreProtocol:
510510
self.backend_secret = self.buffer.read_int32()
511511

512512
cdef _parse_msg_parameter_status(self):
513-
name = self.buffer.read_cstr()
513+
name = self.buffer.read_null_str()
514514
name = name.decode(self.encoding)
515515

516-
val = self.buffer.read_cstr()
516+
val = self.buffer.read_null_str()
517517
val = val.decode(self.encoding)
518518

519519
self._set_server_parameter(name, val)
520520

521521
cdef _parse_msg_notification(self):
522522
pid = self.buffer.read_int32()
523-
channel = self.buffer.read_cstr().decode(self.encoding)
524-
payload = self.buffer.read_cstr().decode(self.encoding)
523+
channel = self.buffer.read_null_str().decode(self.encoding)
524+
payload = self.buffer.read_null_str().decode(self.encoding)
525525
self._on_notification(pid, channel, payload)
526526

527527
cdef _parse_msg_authentication(self):
@@ -611,7 +611,7 @@ cdef class CoreProtocol:
611611
if code == 0:
612612
break
613613

614-
message = self.buffer.read_cstr()
614+
message = self.buffer.read_null_str()
615615

616616
parsed[chr(code)] = message.decode()
617617

asyncpg/protocol/prepared_stmt.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ cdef _decode_row_desc(object desc):
334334
result = []
335335

336336
for i from 0 <= i < nfields:
337-
f_name = reader.read_cstr()
337+
f_name = reader.read_null_str()
338338
f_table_oid = <uint32_t>reader.read_int32()
339339
f_column_num = reader.read_int16()
340340
f_dt_oid = <uint32_t>reader.read_int32()

0 commit comments

Comments
 (0)