bpo-31546: Fix input hook integration (GH-7978)

(cherry picked from commit 9b9d58f0d88b338eb8d2ae0da5cd91d60d1b0e39)

Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
2 files changed