gh-153020: Fix race condition on event_tstate in _tkinter#153640
gh-153020: Fix race condition on event_tstate in _tkinter#153640tangyuan0821 wants to merge 2 commits into
Conversation
ByteFlowing1337
left a comment
There was a problem hiding this comment.
If the race is only possible in FT, why not use macros like FT_ATOMIC_LOAD_PTR or FT_ATOMIC_STORE_PTR to avoid the potential performance overhead in the default build?
Good catch, switched to FT_ATOMIC_* since the race is only under free-threading. The default build just reads and writes it directly. |
ByteFlowing1337
left a comment
There was a problem hiding this comment.
The suffix of the news entry filename looks incorrect. It should be a nonce generated by blurb, see https://devguide.python.org/getting-started/pull-request-lifecycle/#how-to-add-a-news-entry.
| Fix a data race in :mod:`!_tkinter` input event handling in free-threaded | ||
| builds. |
There was a problem hiding this comment.
| Fix a data race in :mod:`!_tkinter` input event handling in free-threaded | |
| builds. | |
| Fix a data race in :mod:`!_tkinter` input event handling under the :term:`free-threaded build`. |
event_tstatein Modules/_tkinter.c is read by the EventHook thread andwritten by the main thread, so they race. I load and store it with atomic
ops, and clear it to NULL in DisableEventHook before the PyThreadState is
released.
event_tstatein_tkinter.cunder free-threading #153020