Merge branch 'master' into asyncio

This commit is contained in:
Lonami Exo
2017-10-29 20:08:32 +01:00
18 changed files with 550 additions and 355 deletions

View File

@@ -91,8 +91,11 @@ class TLObject:
@staticmethod
def serialize_bytes(data):
"""Write bytes by using Telegram guidelines"""
if isinstance(data, str):
data = data.encode('utf-8')
if not isinstance(data, bytes):
if isinstance(data, str):
data = data.encode('utf-8')
else:
raise ValueError('bytes or str expected, not', type(data))
r = []
if len(data) < 254: