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

EventType.__eq__ doesn't handle other is None #152

Open
ajbaldocchi opened this issue Mar 15, 2024 · 0 comments
Open

EventType.__eq__ doesn't handle other is None #152

ajbaldocchi opened this issue Mar 15, 2024 · 0 comments

Comments

@ajbaldocchi
Copy link

ajbaldocchi commented Mar 15, 2024

EventType.eq has the following implementation:
def __eq__(self, other):
return self.__dict__ == other.__dict__

if other is None, this results in the following AttributeError:
File "src/pygame_sdl2/event.pyx", line 90, in pygame_sdl2.event.EventType.__eq__
AttributeError: 'NoneType' object has no attribute '__dict__'

This precludes checks like event == other when other can at any point be None.

When using ren'py 8.1.3, this can be reproduced by using SetScreenVariable to set a screen variable defaulting to None to a pygame_sdl2 EventType object; get_selected() attempts to perform the above equality check (more specifically, cs.scope[self.name] == self.value) and results in this AttributeError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant