Potential Windows-specific lost event race in the implementation of time.sleep
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug description:
In the Windows-specific implementation of time.sleep there appears this code:
If a control-C event happens after PyErr_CheckSignals returns, but before ResetEvent is called, I believe that event may be lost.
This is probably a hard race window to hit, and I don't have a Windows development environment, so I have not confirmed that it is possible.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Windows-specific time.sleep implementation in Modules/timemodule.c at the linked lines, then examine the ordering of PyErr_CheckSignals and ResetEvent. Investigate whether a control-C event can occur in that window on Windows; done means confirming or disproving the lost-event race and documenting or correcting the behavior with coverage if applicable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100