File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -414,24 +414,25 @@ def _serialize_single(
414
414
"""Serializes a single field and value."""
415
415
value = _preprocess_single (proto_type , wraps , value )
416
416
417
- output = bytearray ()
418
417
if proto_type in WIRE_VARINT_TYPES :
419
418
key = encode_varint (field_number << 3 )
420
- output + = key + value
419
+ output = key + value
421
420
elif proto_type in WIRE_FIXED_32_TYPES :
422
421
key = encode_varint ((field_number << 3 ) | 5 )
423
- output + = key + value
422
+ output = key + value
424
423
elif proto_type in WIRE_FIXED_64_TYPES :
425
424
key = encode_varint ((field_number << 3 ) | 1 )
426
- output + = key + value
425
+ output = key + value
427
426
elif proto_type in WIRE_LEN_DELIM_TYPES :
428
- if len ( value ) or serialize_empty or wraps :
427
+ if value or serialize_empty or wraps :
429
428
key = encode_varint ((field_number << 3 ) | 2 )
430
- output += key + encode_varint (len (value )) + value
429
+ output = key + encode_varint (len (value )) + value
430
+ else :
431
+ output = b""
431
432
else :
432
433
raise NotImplementedError (proto_type )
433
434
434
- return bytes ( output )
435
+ return output
435
436
436
437
437
438
def _parse_float (value : Any ) -> float :
You can’t perform that action at this time.
0 commit comments