pyrogram icon indicating copy to clipboard operation
pyrogram copied to clipboard

Recursion problem in message read

Open semohr opened this issue 1 year ago • 0 comments

Checklist

  • [X] I am sure the error is coming from Pyrogram's code and not elsewhere
  • [X] I have searched in the issue tracker for similar bug reports, including closed ones
  • [X] I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip and reproduced the issue using the latest development version

Description

Recently I have run into recursion errors. Someone else encountering these? I have no idea which part of my code produces this problem as the traceback is not very helpful. But it starts in the mtproto part of pyrogram.

Maybe it is custom messages? I found a similar bugfix in the telethon documentation (page115).

Steps to reproduce

Just happens every time I use the get_messagesmethod.

Code example

No response

Logs

Traceback (most recent call last):
  File "*/lib/python3.10/site-packages/pyrogram/session/session.py", line 187, in handle_packet
    data = await self.loop.run_in_executor(
  File "*/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "*/lib/python3.10/site-packages/pyrogram/crypto/mtproto.py", line 70, in unpack
    message = Message.read(data)
  File "*/lib/python3.10/site-packages/pyrogram/raw/core/message.py", line 46, in read
    return Message(TLObject.read(BytesIO(body)), msg_id, seq_no, length)
  File "*/lib/python3.10/site-packages/pyrogram/raw/core/tl_object.py", 
    return cast(TLObject, objects[int.from_bytes(b.read(4), "little")]).read(b, *args)
  File "*/lib/python3.10/site-packages/pyrogram/raw/types/text_concat.py", line 60, in read
    texts = TLObject.read(b)
  File "*/lib/python3.10/site-packages/pyrogram/raw/core/tl_object.py", line 33, in read
    return cast(TLObject, objects[int.from_bytes(b.read(4), "little")]).read(b, *args)
...
more of the same lines
...
  File "*/lib/python3.10/site-packages/pyrogram/raw/core/primitives/vector.py", line 49, in read
    return List(
  File */lib/python3.10/site-packages/pyrogram/raw/core/primitives/vector.py", line 51, in <genexpr>
    else Vector.read_bare(data, size)
RecursionError: maximum recursion depth exceeded

semohr avatar Sep 06 '23 14:09 semohr