mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 21:10:29 +00:00
Fix MemoryError on get_input_media(game)
Because an integer was being passed where a TLObject was expected, so the serialization with bytes() was actually requesting that many bytes as opposed to properly converting the expected object.
This commit is contained in:
18
tests/telethon/test_utils.py
Normal file
18
tests/telethon/test_utils.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from telethon import utils
|
||||
from telethon.tl.types import (
|
||||
MessageMediaGame, Game, PhotoEmpty
|
||||
)
|
||||
|
||||
|
||||
def test_game_input_media_memory_error():
|
||||
large_long = 2**62
|
||||
media = MessageMediaGame(Game(
|
||||
id=large_long, # <- key to trigger `MemoryError`
|
||||
access_hash=large_long,
|
||||
short_name='short_name',
|
||||
title='title',
|
||||
description='description',
|
||||
photo=PhotoEmpty(large_long),
|
||||
))
|
||||
input_media = utils.get_input_media(media)
|
||||
bytes(input_media) # <- shouldn't raise `MemoryError`
|
Reference in New Issue
Block a user