mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-07 18:29:53 +00:00
Byte arrays in Go should not be serialized as arrays.
This commit is contained in:
parent
0e82278cd5
commit
003fb3392f
1 changed files with 7 additions and 0 deletions
|
|
@ -452,6 +452,13 @@ func PackFloatArray(writer io.Writer, value []float) (n int, err os.Error) {
|
|||
}
|
||||
|
||||
func PackArray(writer io.Writer, value reflect.ArrayOrSliceValue) (n int, err os.Error) {
|
||||
{
|
||||
elemType, ok := value.Type().(reflect.ArrayOrSliceType).Elem().(*reflect.UintType)
|
||||
if ok && elemType.Kind() == reflect.Uint8 {
|
||||
return PackBytes(writer, value.Interface().([]byte))
|
||||
}
|
||||
}
|
||||
|
||||
l := value.Len()
|
||||
if l < 16 {
|
||||
n, err := writer.Write([]byte { 0x90 | byte(l) })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue