Quick answer: Pygame.event.set_blocked(KEYDOWN) still allowing keyboard state queries to return pressed? set_blocked filters the event queue, not the OS state - check via key_get_pressed separately.

Blocked KEYDOWN events; key.get_pressed still reports pressed.

Use distinct queries

get_pressed reads OS state; events are separate.

Or filter at event consumer

Don't rely on set_blocked; filter in your handler.

Document the distinction

Polled state vs event queue. Each behaves differently.

“Polled state and event queue are independent. Filtering one doesn't filter the other.”

If you mix polled and event input, document which is the source of truth. The bug class hides in the gap.

Related reading