[issue37503] Queue.join(): Broken example in documentation
Marco Dickert
report at bugs.python.org
Fri Jul 5 04:20:39 EDT 2019
New submission from Marco Dickert <marco at misterunknown.de>:
I guess I found a bug in the documented Queue.join() example [1].
The problem is the break condition for the while loop of the worker. If the item is None, the loop breaks, but the worker never calls item.task_done(). Thus the q.join() statement never returns, because the last task (None) remains unfinished.
This should solve the issue:
```
if item is None:
item.task_done()
break
```
[1] https://docs.python.org/3/library/queue.html#queue.Queue.join
----------
assignee: docs at python
components: Documentation
messages: 347310
nosy: docs at python, misterunknown
priority: normal
severity: normal
status: open
title: Queue.join(): Broken example in documentation
versions: Python 3.5, Python 3.6, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37503>
_______________________________________
More information about the Python-bugs-list
mailing list