mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-135698: Fix Cross-interpreter Queue.full() With Negative/Default max_size (gh-135724)
We weren't handling non-positive maxsize values (including the default) properly in Queue.full(). This change fixes that and adjusts an associated assert.
This commit is contained in:
parent
a8ec511900
commit
c5ea8e8e8f
2 changed files with 62 additions and 13 deletions
|
@ -707,8 +707,11 @@ _queue_is_full(_queue *queue, int *p_is_full)
|
|||
return err;
|
||||
}
|
||||
|
||||
assert(queue->items.count <= queue->items.maxsize);
|
||||
*p_is_full = queue->items.count == queue->items.maxsize;
|
||||
assert(queue->items.maxsize <= 0
|
||||
|| queue->items.count <= queue->items.maxsize);
|
||||
*p_is_full = queue->items.maxsize > 0
|
||||
? queue->items.count == queue->items.maxsize
|
||||
: 0;
|
||||
|
||||
_queue_unlock(queue);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue