bugfix
byte fields were deserialized incorrectly
This commit is contained in:
parent
8f535913a1
commit
0931eb3bf5
@ -39,7 +39,7 @@ fn map_field_value(field_name: &str, field_value: Value, proto_meta: &PyAny) ->
|
|||||||
let py = proto_meta.py();
|
let py = proto_meta.py();
|
||||||
match field_value {
|
match field_value {
|
||||||
Value::Bool(x) => Ok(x.to_object(py)),
|
Value::Bool(x) => Ok(x.to_object(py)),
|
||||||
Value::Bytes(x) => Ok(x.to_object(py)),
|
Value::Bytes(x) => Ok(PyBytes::new(py, &x).to_object(py)),
|
||||||
Value::F32(x) => Ok(x.to_object(py)),
|
Value::F32(x) => Ok(x.to_object(py)),
|
||||||
Value::F64(x) => Ok(x.to_object(py)),
|
Value::F64(x) => Ok(x.to_object(py)),
|
||||||
Value::I32(x) => Ok(x.to_object(py)),
|
Value::I32(x) => Ok(x.to_object(py)),
|
||||||
|
@ -32,6 +32,7 @@ class Bar(betterproto.Message):
|
|||||||
enm: Enm = betterproto.enum_field(4)
|
enm: Enm = betterproto.enum_field(4)
|
||||||
map: Dict[int, bool] = betterproto.map_field(5, betterproto.TYPE_INT64, betterproto.TYPE_BOOL)
|
map: Dict[int, bool] = betterproto.map_field(5, betterproto.TYPE_INT64, betterproto.TYPE_BOOL)
|
||||||
maybe: Optional[bool] = betterproto.message_field(6, wraps=betterproto.TYPE_BOOL)
|
maybe: Optional[bool] = betterproto.message_field(6, wraps=betterproto.TYPE_BOOL)
|
||||||
|
bts: bytes = betterproto.bytes_field(7)
|
||||||
|
|
||||||
# Serialization has not been changed yet. So nothing unusual here
|
# Serialization has not been changed yet. So nothing unusual here
|
||||||
buffer = bytes(
|
buffer = bytes(
|
||||||
@ -44,7 +45,8 @@ buffer = bytes(
|
|||||||
1: True,
|
1: True,
|
||||||
42: False
|
42: False
|
||||||
},
|
},
|
||||||
maybe=True
|
maybe=True,
|
||||||
|
bts=b'Hi There!'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user