The Wayback Machine - https://web.archive.org/web/20201210054825/https://github.com/pyrogram/pyrogram/pull/423
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__repr__ raises AttributeError: 'int' object has no attribute 'QUALNAME' #423

Closed
wants to merge 1 commit into from

Conversation

@gaudat
Copy link

@gaudat gaudat commented Jun 17, 2020

repr-ing a "pyrogram.api.types.UpdateDeleteChannelMessages" object currently throws this exception.

It is expected to print something like the following (channel_id, message and pts redacted):
pyrogram.api.types.UpdateDeleteChannelMessages(channel_id=1234567890, messages=pyrogram.api.core.List([1234567]), pts=1245678, pts_count=1)

Added checks in "list.py" to see if contents of a List is not a TLObject (from the absence of a "QUALNAME" attribute). Use native repr function if this is the case.

Copy link
Member

@delivrance delivrance left a comment

@gaudat Thanks for the contribution. However, the fix should be applied to TLObject.__repr__ (located in pyrogram/api/core/tl_object.py). You can add this at the beginning of the function:

if not hasattr(self, "QUALNAME"):
    return repr(self)
@gaudat
Copy link
Author

@gaudat gaudat commented Aug 21, 2020

Incorporated changes.

@delivrance
Copy link
Member

@delivrance delivrance commented Aug 30, 2020

I couldn't reproduce the issue using latest changes (the repo underwent a deep rewrite), but I found some other minor issues related to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.