This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Hang when calling get() on an empty queue in the queue module
Type: behavior Stage:
Components: Versions: Python 3.0
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, benjamin.peterson, slash2314, tazle
Priority: normal Keywords:

Created on 2008-06-19 08:08 by slash2314, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg68393 - (view) Author: Dex (slash2314) Date: 2008-06-19 08:08
This behavior appears in Python 3.0b1.  If you use queue.Queue and call
the get method on the empty queue, it appears to hang.  The same
behavior seems to be evident in the PriorityQueue too.
msg68396 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-06-19 09:32
2.5 has the same behavior:

Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import Queue
>>> q = Queue.Queue()
>>> q.get()
.... block forever ...

Did you get different results?
msg68401 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-06-19 12:49
It's intended that Queue.get blocks until something is put on the Queue.
If you don't want it to block use Queue.get(False).
msg84269 - (view) Author: Tuure Laurinolli (tazle) Date: 2009-03-27 16:07
Is it also intended that Queue.get() eats SIGINTs, requiring one to kill
the process with something heavier?
History
Date User Action Args
2022-04-11 14:56:35adminsetgithub: 47388
2009-03-27 16:07:11tazlesetnosy: + tazle
messages: + msg84269
2008-06-19 12:49:02benjamin.petersonsetstatus: open -> closed
resolution: not a bug
messages: + msg68401
nosy: + benjamin.peterson
2008-06-19 09:32:27amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg68396
2008-06-19 08:08:16slash2314create