-
Notifications
You must be signed in to change notification settings - Fork 407
fix: improve handling deleted GH users #1161
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
Hi @sigmavirus24, could you please approve the workflows? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't default to None of I remember correctly. People will instead have an Attribute Error trying to access something that otherwise is there
I'm not sure I understand. Are you saying that this won't help, because people will get a different Error when accessing a property on I guess an alternative would be to initialize a GhostUser object instead, as if https://github.com/ghost was a real user. PS: The failing Python 3.9/3.10 tests seem unrelated. |
The more I think about it, the more I like the idea of a GhostUser object or a Ghost sentinel that we can return. |
@caugner are you still interested in implementing a GhostUser? |
Prevents the following TypeError with events of deleted users (aka "ghost"): ``` File "/path/to/github3/models.py", line 52, in __init__ self._update_attributes(json) File "/path/to/github3/issues/event.py", line 63, in _update_attributes self.actor = users.ShortUser(event["actor"], self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/path/to/github3/models.py", line 52, in __init__ self._update_attributes(json) File "/path/to/github3/users.py", line 309, in _update_attributes self.avatar_url = user["avatar_url"] TypeError: 'NoneType' object is not subscriptable ```
`owner` is null if the user who opened the PR no longer exists on GitHub.
351ddf3
to
35ce354
Compare
Prevents the following TypeError with events of deleted users (aka "ghost"):
Fixes #988.
Version Information
Please provide:
Minimum Reproducible Example
n/a
Exception information
n/a