Just extend `frames2` by `frames`
Instead of coercing `frames` to a `list` to then later copy it again,
just include `frames` in whatever iterable form it may be in `frames2`.
This avoids the extra copy with the same net effect.
@@ -515,7 +515,7 @@ def serialize_bytelist(x, **kwargs):
header["count"] = len(frames)
header = msgpack.dumps(header, use_bin_type=True)
- frames2 = [header] + list(frames)
+ frames2 = [header, *frames]
return [pack_frames_prelude(frames2)] + frames2
