-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Description
Checklist
- I am confident this is a bug in CPython, not a bug in a third-party project
- I have searched the CPython issue tracker,
and am confident this bug has not been reported before
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.11.4 (main, Jun 9 2023, 07:59:55) [GCC 12.3.0]
A clear and concise description of the bug:
If the current putter has an exception thrown (such as when the task awaiting put() has an exception thrown) and the queue isn't full (which can happen if another task put()s before the current task is rewoken), then the queue must wake up the next putter, because otherwise nothing else will wake up the next putter. This line is responsible for this:
Line 130 in 42429d3
| if not self.full() and not putter.cancelled(): |
Unfortunately that condition - specifically not putter.cancelled() - will never be met because just before, this:
Line 122 in 42429d3
| putter.cancel() # Just in case putter is not done yet. |
This affects both put() and get(). I propose moving cancel() to just before the raise.
There is no test case - this is something I noticed while reading asyncio/queue.py.
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status