From 98c2e1dd4f00db54e77a161aaa1aac7e1f4b687c Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 26 Sep 2017 14:41:11 +0200 Subject: [PATCH] Replace 4 .append calls with a single one when serializing bytes --- telethon/tl/tlobject.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/telethon/tl/tlobject.py b/telethon/tl/tlobject.py index 609ae143..b67fdc62 100644 --- a/telethon/tl/tlobject.py +++ b/telethon/tl/tlobject.py @@ -101,10 +101,12 @@ class TLObject: if padding != 0: padding = 4 - padding - r.append(bytes([254])) - r.append(bytes([len(data) % 256])) - r.append(bytes([(len(data) >> 8) % 256])) - r.append(bytes([(len(data) >> 16) % 256])) + r.append(bytes([ + 254, + len(data) % 256, + (len(data) >> 8) % 256, + (len(data) >> 16) % 256 + ])) r.append(data) r.append(bytes(padding))