New submission from Marco Dickert <ma...@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@python
components: Documentation
messages: 347310
nosy: docs@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue37503>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to