pygame_sdl2 icon indicating copy to clipboard operation
pygame_sdl2 copied to clipboard

EventType.__eq__ doesn't handle other is None

Open ajbaldocchi opened this issue 2 years ago • 0 comments

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.

ajbaldocchi avatar Mar 15 '24 14:03 ajbaldocchi