Alex Holkner wrote:
An additional undocumented signature is available:
pygame.event.peek(): return Event
The function returns the next event instead of a bool if no arguments
are given.
The returned event is filled with nonsense (uninitialized) values if
no event is in the queue. Suggest it return None in this case
instead, or that the undocumented functionality be removed entirely.
Alex.
Having just looked at the pygame.event.post() code: it is possible to
crash pygame (or at the very least, get garbage values) by posting a
user event with a dictionary, then peeking that event more than once (or
peeking it and then getting it).
User event dictionaries are freed when requested, so if peek() with no
arguments is desired, "user_event_getobject" needs to be modified to not
free "userobj" when peeking, only when getting.
Alex.