]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-128130: Fix unhandled keyboard interrupt data race (gh-129975)
authorSam Gross <colesbury@gmail.com>
Thu, 13 Feb 2025 17:29:03 +0000 (12:29 -0500)
committerGitHub <noreply@github.com>
Thu, 13 Feb 2025 17:29:03 +0000 (12:29 -0500)
commit451f291baaff918228ace4e8257be42737d7654a
tree0824f1f7ab3b13a292bf1c4a9a01b13c63915e2a
parentaa284232013693103431fb672a0bcabac3d4200b
gh-128130: Fix unhandled keyboard interrupt data race (gh-129975)

Use an atomic operation when setting
`_PyRuntime.signals.unhandled_keyboard_interrupt`. We now only clear the
variable at the start of `_PyRun_Main`, which is the same function where
we check it.

This avoids race conditions where previously another thread might call
`run_eval_code_obj()` and erroneously clear the unhandled keyboard
interrupt.
Include/internal/pycore_pylifecycle.h
Modules/main.c
Python/pythonrun.c
Tools/c-analyzer/TODO